0
pls say the error
class rahularr { Public static void main(String args[]) { int a[] = new int[10]; int i,val; scanner=new Scanner(System.in); System.Out.Println("enter an arroy"); for(i=0;i<10;i++) { val=s.nextInt(); a[i]=val; } System.Out.Println("the arroy"); for(i=0;i<10;i++) { System.Out.Println(a[i]); } } }
5 Antworten
+ 1
you should be declare a variable of scanner type to use the scanner
+ 1
and also put S capital in the scanner line
0
Scanner scanner = new Scanner();
0
Yeah your scanner needs a name
0
Line 2: public static void main(String args[])
public with a small "p".
Line 4: always initialize variables inside a method.
Line 5: Scanner s = new Scanner(System. in);
This way you can use " s" to take in inputs I.e, s.nextInt();
Line 6,9,11: System.out.println();
The o in out and p in println is in lowercase.