Explain the usage of the following special symbol in Java: ;(semicolon)
Advertisements
Question
Explain the usage of the following special symbol in Java:
;(semicolon)
Explain
Advertisements
Solution
The semicolon (;) is used in Java to indicate the end of a statement. It is known as a statement terminator. It tells the Java compiler where one statement ends and helps separate individual statements in a program. A semicolon is generally required at the end of variable declarations, assignment statements, and method calls.
Example:
int a = 10;
int b = 20;
System.out.println(a + b);
shaalaa.com
Is there an error in this question or solution?
