Answers for "case break java"

83

java switch

int day = 4;
switch (day) {
  case 6:
    System.out.println("Today is Saturday");
    break;
  case 7:
    System.out.println("Today is Sunday");
    break;
  default:
    System.out.println("Looking forward to the Weekend");
}
// Outputs "Looking forward to the Weekend"
Posted by: Guest on March-11-2020
1

break statement in java

// break statement in java
public class BreakStatementExample
{
   public static void main(String[] args) 
   {
      for(int a = 1; a <= 10; a++)
      {
         if(a == 3)
         {  
            // breaking loop  
            break;  
         }  
         System.out.println(a);  
      }
   }
}
Posted by: Guest on February-19-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language