Hi guys,
Im having a spot of bother with a bit of exception handling ive got to do for uni, is it possible for someone to give me a bit of advise on where im going wrong please.
Driver Class
This is the error im getting
Any help/advice greatly appreciated.
Im having a spot of bother with a bit of exception handling ive got to do for uni, is it possible for someone to give me a bit of advise on where im going wrong please.
Driver Class
Code:
public class ExceptionHomeworkDriver
{
public static void main ( String [] args)
{
ExceptionHomework exHmwk = new ExceptionHomework();
exHmwk.Data();
System.out.println("Good Bye");
}
}
Code:
public class ExceptionHomework
{
Scanner scan ;
int data;
int slot;
int[] value;
public ExceptionHomework()
{
scan = new Scanner( System.in );
data=0;
slot=0 ;
value = new int[10];
}
public void Data()
{
do
{
try
{
System.out.print("Enter the data: ");
data = scan.nextInt();
System.out.print("Enter the array index: ");
slot = scan.nextInt();
value[slot] = data;
}
catch (NumberFormatException nfe)
{
System.out.println("Exception "+nfe.toString()+ " caught\n");
}
}
while(!done);
}
}
This is the error im getting
Code:
D:\Uni\Semester 2\Java\Hmwk8\Homework8\ExceptionHomework.java:50: cannot find symbol
symbol : variable done
location: class ExceptionHomework
while(!done);
Any help/advice greatly appreciated.