Errors and Avoiding them etc Flashcards

1
Q

what does exception in thread java.util.InputMismatchConception mean

A

input mismatch eg we asked for an int and got a string or character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

how can we check our input is in the form we want it to be in to avoid inputMismatch

A

input. hasNextInt()

input. hasNextDouble() …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what type is input.hasNext

A

boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what are syntax errors

A

breaking the rules of java writing so that programs cannot compile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

how are syntax errors handled

A

by computer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what are runtime errors

A

program fails under some circumstances eg divide by 0

terminates program if cannot be handled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how can runtime errors be fixed

A

handled in code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what are sematic erros

A

when the program doesn’t solve the problem it was meant to solve eg not understanding what was being asked of you

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how can sematic errors be found

A

extensive testing of code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is it called when we deal with errors by the problems they cause in code

A

excepption handling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

example of dealing with runtime errors when they occur

A

if !input.hasNextInt ()
{
System.out.print(“Error: You must enter a whole number”);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what can we find out from exception handling errors

A

where the error is

what raised the exception

How well did you know this?
1
Not at all
2
3
4
5
Perfectly