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

Respuesta :

ijeggs

Answer:

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.

In every computer system, the semicolons tell that the current statement has been terminated and another statement follows the new statement. Every statement should end in a semi-colon.  

  • It shows that an executable statement can be split into several sources files to help readable.
  • Hence the option A is correct. statement in a program must end with a semicolon.

Learn more about the following statements is correct.

brainly.com/question/2584008.