Answers for "java switch statement how does it go through all cases"

1

java switch tutorial

For details about Java Switch tutorial visit website:
https://www.allaboutjava.com/2021/07/java-switch-statements.html
Posted by: Guest on July-21-2021
-1

switch statement in while loop java

Scanner input=new Scanner(System.in);
int selection = input.nextInt();

while (selection<4)
{
   switch(selection){
        case 1:
           System.out.println("Please enter amount");
           double amount=input.nextDouble(); //object of scanner class
           break;

        case 2:
           System.out.println("Enter ID number"); 
           break;

        case 3:
           System.out.println("Enter amount to be credited");
           break;
      }
      System.out.println("1. Transfer\n2.Check balance\n3.Recharge");
      selection = input.nextInt(); // add this
 }
Posted by: Guest on May-22-2021

Code answers related to "java switch statement how does it go through all cases"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language