Click here to watch in Youtube :
https://www.youtube.com/watch?v=WaSDgEPg1cM&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java if then else statement |
Java Tutorial : Java if then else statement |
class ControlFlowDemo { public static void main(String[] args) { boolean flag = false; if (flag) { System.out.println("flag is true,inside if block."); } else { System.out.println("flag is false,inside else block."); } } }
flag is false,inside else block.
class IfElseDemo { public static void main(String[] args) { int testscore = 81; char grade; if (testscore >= 90) { grade = 'A'; } else if (testscore >= 80) { grade = 'B'; } else if (testscore >= 70) { grade = 'C'; } else if (testscore >= 60) { grade = 'D'; } else { grade = 'F'; } System.out.println("Grade = " + grade); } }
Grade = B
https://sites.google.com/site/javaee4321/java/ControlFlowDemoIf-Then-Else-App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ControlFlowDemoIf-Then-Else-App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/08783475a968761a2cf4b3fc7275842653545b35/BasicJava/ControlFlowDemoIf-Then-Else-App/?at=master
See also:
No comments:
Post a Comment