Ask Question
29 July, 08:52

Which of the following statements is correct?

A) Every statement in a program must end with a semicolon.

B) Every line in a program must end with a semicolon.

C) Every method must end with a semicolon.

D) Every comment line must end with a semicolon.

E) Every class must end with a semicolon

+4
Answers (1)
  1. 29 July, 10:44
    0
    A

    Explanation:

    In Java, C++, C# programming languages every statement (executable statements must end with a semi-colon (; ). The semi-colon indicates an 'end of thought' and it is a compiler error to omit it.

    Other languages like python and microsoft visual basic does not have this requirment.

    So in java

    System. out. println ("Hello World") / /will give a compiller error, missing semi-colon.

    Note that this is different from option (B) in the question because not every line of code ends with a semi-colon for example a line declaring a method or a comment line cannot end with a semi-colon.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Which of the following statements is correct? A) Every statement in a program must end with a semicolon. B) Every line in a program must ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers