+ 1
What's the problem?
2 Answers
+ 1
You specifying the import statement after the class declaration.
In Java the structure for a Java source file is :
1. Package statement (package keyword followed by the current library that this Java file is defined in)
2.Import statement (import keyword followed by the library to utilise)
3.Class declaration eg.
class Program { }
its should be :
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
System.out.println(n);
}
0
Thanks