About 1,180,000 results
Open links in new tab
  1. java - Using switch statements inside a for loop - Stack Overflow

    Nov 14, 2012 · The switch/case statement inside of a for loop is fine, the problem is that switch isn't a function call. Try something like this:

  2. java - Looping through a switch statement - Stack Overflow

    Nov 22, 2014 · One easy option is to declare a Boolean variable and wrap the switch in a while loop e.g. Boolean quit = false; while (!quit) //or do-while { int opt = menu(); switch(opt) { //other …

  3. Java Switch - W3Schools

    Instead of writing many if..else statements, you can use the switch statement. The switch statement selects one of many code blocks to be executed: This is how it works: The switch …

  4. Switch Statements in Java - GeeksforGeeks

    Apr 11, 2025 · In simple words, the Java switch statement executes one statement from multiple conditions. It is an alternative to an if-else-if ladder statement. It provides an easy way to …

  5. Decision Making in Java (if, if-else, switch, break, continue, jump)

    Apr 16, 2025 · The Break Statement in Java is a control flow statement used to terminate loops and switch cases. As soon as the break statement is encountered from within a loop, the loop …

  6. Java Loops - GeeksforGeeks

    Apr 7, 2025 · Java provides three ways for executing the loops. While all the ways provide similar basic functionality, they differ in their syntax and condition-checking time. Loops in Java. In …

  7. Java Switch Case Statement With Programming Examples

    Apr 1, 2025 · Switch Case Using For Loop. Given below is the example program where we have demonstrated how Java Switch statement works or can be used in the programs. First of all, …

  8. java - Can we use for loop with switch statement ... - Stack Overflow

    Jan 24, 2019 · I am trying to iterate for loop by using switch statement. I want to print particular data from that switch statement. I am taking data in one array, like 5,6 and i am iterating loop …

  9. Part 12 - Nested Loop & Java Switch - Appcitor

    Jul 28, 2020 · For example, you can put while loop inside the body of a for loop. Java Switch Switch statement is used when we have number of options and we may need to perform a …

  10. loops - Looping switch case in java - Stack Overflow

    Oct 24, 2020 · switch (levelCode) { case 'F': System.out.print("Total Foundation student = "); studentFoundation = input.nextInt(); foundationCash = studentFoundation * 50; break; case …

Refresh