Java Compilation Errors

👁 13
statistics
by Dr. Osama M. Khaled last modified 2022-07-19T05:23:38+01:00

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

Questions #: 4
Time:
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: