Question: What will be the output if the following code is placed at line 10 of the preceding class definition? Assume that the user enters 5.
1 public class Test2 3 public static void main( String args]) 4 Scanner input = new Scanner (System.in); int numberl; 6 7 8 9 10 System.out.printIn(Enter an integer: " ); numberl input.nextInt O; 12 13 14 15 16 if( number1 % 2-0) System outrintld is even Vn", number1 ): else System.ou,RcintIn(.%d is odd ", number1 ) ; 3 // end main // end class Test2 il be outout hy lines 11-14 if the user enters the integer 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
