Errors and Avoiding them etc Flashcards
what does exception in thread java.util.InputMismatchConception mean
input mismatch eg we asked for an int and got a string or character
how can we check our input is in the form we want it to be in to avoid inputMismatch
input. hasNextInt()
input. hasNextDouble() …
what type is input.hasNext
boolean
what are syntax errors
breaking the rules of java writing so that programs cannot compile
how are syntax errors handled
by computer
what are runtime errors
program fails under some circumstances eg divide by 0
terminates program if cannot be handled
how can runtime errors be fixed
handled in code
what are sematic erros
when the program doesn’t solve the problem it was meant to solve eg not understanding what was being asked of you
how can sematic errors be found
extensive testing of code
what is it called when we deal with errors by the problems they cause in code
excepption handling
example of dealing with runtime errors when they occur
if !input.hasNextInt ()
{
System.out.print(“Error: You must enter a whole number”);
}
what can we find out from exception handling errors
where the error is
what raised the exception