Why i cant write anything before a switch | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Why i cant write anything before a switch

24th Jan 2020, 7:37 AM
Solestebano
6 Réponses
+ 2
Can you show us the code and elaborate more on what you are trying to achieve?
24th Jan 2020, 7:46 AM
Fermi
Fermi - avatar
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"); } } }
24th Jan 2020, 7:55 AM
Solestebano
0
Im fool
24th Jan 2020, 8:11 AM
Solestebano
0
The code beyond the switch was still on the switch
24th Jan 2020, 8:13 AM
Solestebano
0
that's why it doesn't run
24th Jan 2020, 8:13 AM
Solestebano