1.
The keyword void is missing before main in line 2.
The string Hello World Example should be closed with a closing
quotation mark in line 3.
Since a single error will often display many lines of compile errors, it is a
good practice to fix errors from the top line and work downward. Fixing
errors that occur earlier in the program may also fix additional errors that
occur later.
2. runtime errors is division by zero
3. Logic errors occur when a program does not perform the way it was
intended to. Errors of this kind occur for many different reasons. For
example, suppose you wrote the program to convert Celsius 35 degrees to
a Fahrenheit degree:
OUTPUT: Celsius 35 is Fahrenheit degree
67
4. [Link], [Link]
5.
ExcitingGame OK: mixed upper and lower case is allowed
Lady Luck BAD: no spaces allowed inside an identifier
x32 OK: identifiers must start with an alphabetical character, but the rest can be digits.
lastChance OK: class names usually start with a capital, but identifiers don't have to.
x/y BAD: the slash is not allowed inside an identifier
1stPrize BAD: starts with a digit
6. public static void main(String[] args )
The Java compiler would accept the line. But it looks sloppy to human eyes.
7. Yes, yes, no, it has a bug.
8. Any three statements within quotes.
9. Consider the following class definitions.
public class Ex12_3
{ public int x; public int y; }
public class Ex12_3sub extends Ex12_3
{
public int y = 1; public int z = 1;
}
What is the output of the following program?
10.