Question: class Validator { int [ ] studentId = { 1 0 1 , 1 0 2 , 1 0 3 } ; / / Corrected
class Validator int studentId ; Corrected array initialization public void validateStudentint id try for int index ; index studentId.length; index Corrected loop if id studentIdindex Corrected comparison System.out.printlnP; finally System.out.printlnQ; Finally block public class Tester public static void mainString args Validator validator new Validator; Corrected object creation try validator.validateStudent; Method call System.out.print; Empty print statement catch ArrayIndexOutOfBoundsException e System.out.println; Catch block wont be triggered finally System.out.println; Finally block for Tester
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
