Skip to content

jugalkrajput/Day-2-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Decision Making Statements

Used to execute different blocks of code based on conditions.

  • if
  • if-else
  • else-if ladder
  • switch

Example

int age = 18;

if(age >= 18){

System.out.println("Eligible for voting");

}

else{

System.out.println("Not eligible");

}

Looping Statements

Used to execute a block of code repeatedly.

  • for loop
  • while loop
  • do-while loop

Example

for(int i = 1; i <= 5; i++){

System.out.println(i);

}

Jump Statements

Used to alter the normal flow of execution.

  • break
  • continue
  • return

Example

for(int i = 1; i <= 10; i++){

if(i == 5){

    break;

}

System.out.println(i);

}

About

Practiced Java Control Statements including decision-making statements (if-else, else-if, switch), looping statements (for, while, do-while), and jump statements (break, continue, return).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages