Explain the usage of the following special symbol in Java: {}(braces)
Advertisements
प्रश्न
Explain the usage of the following special symbol in Java:
{}(braces)
स्पष्ट करा
Advertisements
उत्तर
The braces {} are used in Java to define a block of code. They mark the beginning and end of classes, methods, loops, and conditional statements. The opening brace { indicates the start of a block, while the closing brace } indicates its end. They help group multiple statements together so that they are treated as a single block.
Example:
if (a > b)
{
System.out.println("a is greater");
}
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
