public class Array public static void main() // Declarations num dep num count[5
ID: 3635098 • Letter: P
Question
public class Array
public static void main()
// Declarations
num dep
num count[5] = 0, 0, 0, 0, 0
try
count[dep] = count[dep] + 1
endtry
catch(ArrayIndexOutOfBounds8Exception)
Output “Now you’ve gone too far”
endcatch
Return
Endclass
This is as far as I seem to get but I know it is not complete.
Explanation / Answer
Please Rate:Thanks
public class Array{
public static void main(String[] args){
int dep=0;
int[] count;
count=new int[5];
count[0]=0;
count[1]=0;
count[2]=0;
count[3]=0;
count[4]=0;
try{
count[dep] = count[dep] + 1;
} catch(ArrayIndexOutOfBoundsException e){
System.out.println("Now you’ve gone too far");
}
for(int i=0;i<5;i++)
System.out.println(count[i]+" ");
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.