21st Jan 2020, 6:02 AM
Anubrat Padhee
Anubrat Padhee - avatar
2 odpowiedzi
+ 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); }
21st Jan 2020, 6:18 AM
Justin Joseph
Justin Joseph - avatar
0
Thanks
21st Jan 2020, 6:24 AM
Anubrat Padhee
Anubrat Padhee - avatar