About 370,000 results
Open links in new tab
  1. Java: How to implement switch on Class? - Stack Overflow

    Jan 15, 2014 · How do I implement the following pseudocode in Java? switch (type) case A.class: return createA(param1, param2); case B.class: return createB(param3, param4, param5); default: throw new AssertionError("Unknown type: " + type);

  2. 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 expression is evaluated once. The value of the expression is compared with the values of each case. If there is a match, the associated block of code is executed.

  3. Switch Case in Java with Example - DataFlair

    Switch Case in Java helps programmer in better decision making. Learn syntax and implementation of Switch case & nested switch with examples.

  4. Please check my answer to a pseudocode CASE statement question

    Jan 14, 2020 · There's no one way of doing pseudo code. switch(DAY) case 1: print("Monday") case 2: print("Tuesday") case 3: print("Wednesday") case 4: print("Thursday") case 5: print("Friday") case 6: print("Saturday") case 7: print("Sunday") default: print("Invalid Day!")

  5. Q: swith-case in pseudocode?? — boards.ie - Now Ye're Talkin'

    Nov 10, 2004 · So a simple switch statement might look like:... switch (var1) {case 1: print "Option 1" break case 2: print "Option 2" break default : print "Invalid" break}... So just leave out any obvious programming notation like ';' and the full printf command.

  6. CASE CASE OF something som ething = this: statement som ething = that: statement som ething = other: statement def ault: statement END CASE In a case statement (that’s switch statement to Java/C# people) you can have however many options you want, but there must

  7. Select Case — Computer Based Problem Solving 1.0.5 …

    The Select Case or Switch Case statement is also a decision structure that is sometimes preferred because code might be easier to read and understand, by people. The Select Case structure takes a variable and then compares it to a list of expressions.

  8. 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 dispatch execution to different parts of the code based on the value of the expression.

  9. Decision Branching – switch/case - Know the Code

    Below is some pseudocode to show a multistate decision tree: Convert the multi-state decision tree into a less verbose format with a switch/case statement: switch ( expression ) // expression's value is matched to each of the case statements. case value1: // If the expression matches this value, then do this block of code.

  10. Java Question: Is it possible to have a switch statement within another ...

    Feb 5, 2010 · Use (STRING.charAt(0) == 'y') as your test case, or something methodical like boolean isY(final String STRING) { return (STRING.charAt(0) == 'y' || STRING.charAt(0) == 'Y'); } Yes. Switches break the language block statement pattern, but this is mainly because of C/C++ from which the switch statement used by Java is based.

  11. Some results have been removed
Refresh