volume_mute

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

publish date2021/07/09 22:56:00 GMT+10

volume_mute

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

: ';' is missing
: ';' expected
: ';' needed
: ';' semi-colon expected

Correct Answer

: ';' expected

Explanation

If you mistype part of a program, the compiler may issue a syntax error. The message usually displays the type of the error, the line number where the error was detected, the code on that line, and the position of the error within the code. Here's an error caused by omitting a semicolon (;) at the end of a statement:

Reference

https://www.cis.upenn.edu/~bcpierce/courses/629/papers/Java-tutorial/getStarted/problems/index.html


Quizzes you can take where this question appears