This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IfElseStatementExample { | |
public static void main(String[] args) { | |
// Initialization | |
int score = 0; | |
String today = ""; | |
// Example 1: if Statement | |
score = 150; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EnumSwitchStatementExample { | |
public static void main(String[] args) { | |
// Using enum Type Argument in The switch Statement | |
Day day = Day.TUESDAY; | |
switch (day) { | |
case MONDAY: | |
case TUESDAY: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BreakStatementExample { | |
public static void main(String[] args) { | |
// Using break statement in for loop | |
System.out.println("Using break statement in for loop"); | |
for (int count = 1; count <= 10; count++) { | |
if (count == 6) { | |
break; | |
} |
OlderNewer