Ask Question
27 January, 04: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. 27 January, 07:15
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers