English

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?
Chapter 6: Variables and Expressions - EXERCISE [Page 135]

APPEARS IN

Dheeraj Mehrotra Computer Science [English] Class 12
Chapter 6 Variables and Expressions
EXERCISE | Q 60. (b) | Page 135
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×