pls say the error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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]); } } }

8th Mar 2016, 9:53 AM
Rahul raj
Rahul raj - avatar
5 Answers
+ 1
you should be declare a variable of scanner type to use the scanner
22nd Jun 2016, 3:59 PM
gandhiyash
+ 1
and also put S capital in the scanner line
24th Jun 2016, 4:38 AM
gandhiyash
0
Scanner scanner = new Scanner();
17th Mar 2016, 9:45 PM
serat
0
Yeah your scanner needs a name
24th Jun 2016, 4:27 AM
Bobby Turnip (Scye)
Bobby Turnip (Scye) - avatar
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.
24th Jun 2016, 1:50 PM
Beardman13