Sunday, September 6, 2015

if…else Double-Selection Statement in java

The if single-selection statement performs an indicated action only when the condition

is true; otherwise, the action is skipped.The ifelse double-selection statement allows

you to specify an action to perform when the condition is true and a different action when

the condition is false. For example, the pseudocode statement
 
If student’s grade is greater than or equal to 60
Print “Passed”
Else
Print “Failed”
 
 
 
 

prints “Passed” if the student’s grade is greater than or equal to 60, but prints “Failed” if

it’s less than 60. In either case, after printing occurs, the next pseudocode statement in sequence

is “performed.”
 
The preceding IfElse pseudocode statement can be written in Java as

 

public class Apples {

public static void main(String[] args){

int studentGrade = 70;

if ( studentGrade >= 60 )

System.out.println( "Passed" );

else

System.out.println( "Failed" );


}

}


thanks
we are going talk next about
while Repetition Statement

1 comment:

  1. I'm starting to understand things a little better in each class , nice class Mr.Gabr !!!

    ReplyDelete