Computer Science, asked by sujaldeep942, 6 hours ago

Debug the errors in the following program along with the line no.



line 1: Scanner sc = New Scanner ( System.in);

line 2: System.out.println( “ Enter your age “);

line 3: int age=sc.nextint( ) ;

line 4: int k==age>18 ? vote : cannot vote ;

line 5: System.out.println( k );


Hope that you"all can help me ❤​

Answers

Answered by atrs7391
11

Debugged corrected program:

line 1: Scanner sc = new Scanner(System.in);

line 2: System.out.println( "Enter your age ");

line 3: int age = sc.nextInt();

line 4: String k = age > 18 ? "vote" : "cannot vote";

line 5: System.out.println(k);

Similar questions