+ 2
The compiler is throwing an error that there is no public class but I am unable to find any mistake.
import java.util.Scanner; class sample { public static void main(String[] args) { Scanner input=new Scanner(System.in); int x=input.nextInt(); System.out.println("x:"+x); } }
3 Answers
+ 5
harshit It works fine. No error
+ 1
The code is okay maybe the problem could be the compiler
0
in which compiler you have tried?