Java Compilation Errors

This quiz will help you recognize common compilation errors. Usually, IDEs are powerful enough to capture such errors on the fly. However, it is very important to know them by heart as you may be in a situation using only Javac and you do not want to waste a lot of time
picture_as_pdf Worksheet

QUESTION OF
calculate
Questions #: 4
Pass Score: 80.0%
Style
Mode

Which method will give a compilation error?

(a)
public boolean isRich(int money) {

   if (money != 0)
     return true;
   else 
      return false;
}

(b)
public boolean isRich(int money) {

   if (money != 0)
     return true;

}
POINTS (1)

Correct Answer

Explanation

What is the error message that the compiler will show if a semi-colon is missing?

System.out.println("Line has " + num + " chars.")

POINTS (1)

Correct Answer

Explanation

Does Javac compiler generate .class file even if there is a compile error?

POINTS (1)

Correct Answer

Explanation

What are the number of compilers Java had before Java 8?

POINTS (1)

Correct Answer

Explanation

Views
:
Trials
:
Avg score
:
0
sin cos tan
sin-1 cos-1 tan-1 π e
xy x3 x2 ex 10x
y√x 3√x √x ln log
( ) 1/x % n!
7 8 9 + MS
4 5 6 M+
1 2 3 × M-
0 . EXP ÷ MR
± RND C = MC

Document Actions