+ 3
Find fault.
help me to find fault in this program import java.util.Scanner; public class Main { public static void main(String[]args) { Scanner n=new Scanner(System.in); System.out.println(n); int x=n.nextInt(); switch(x) { case 1: System.out.println("Monday"); break; case 2: System.out.println("Tue"); } } }
3 Respostas
+ 3
You can't print n because it is a Scanner.
+ 1
you need break; after case 2
+ 1
You can also add deafult case (if user input will not be 1 or 2)