0
Why i cant write anything before a switch
6 Answers
+ 2
Can you show us the code and elaborate more on what you are trying to achieve?
0
I do this fast example
import java.util.*;
public class Program
{
public static void main(String[] args) {
int var1;
Scanner in = new Scanner(System.in);
System out.println("Say a number between 1-3");
var1 = in.nextInt();
switch(var1){
case 1:System.out.println("Is the 1");
break;
case 2:System.out.println("Is the 2");
break;
case 3:System.out.println("Is the 3");
break;
default:System.out.println("IDK");
System.out.println("End");
}
}
}
0
Im fool
0
The code beyond the switch was still on the switch
0
that's why it doesn't run