Skip to main content

Posts

Showing posts with the label Conditional Statements: Switch Statement

Conditional Statements: Switch Statement

Java | Switch Statement: Switch statement is the one of the conditional statement. It provide the multiple options to choose the one of them by checking the condition. Syntax:                           switch ( condition )                                        {                                                  case 1:                                                          // statements...                                                         break;                                                  case 2:                                                         // statements...                                                         break;                                                  default:                                                        // statements...                                         } Here is the Code: import java.io.*; class Main { public static void main (String[] args) {     int i = 3;     switch(i)     {         case 1:             System.out.