.

The break and continue Statement

Using break statement : When a break statement is encountered inside a loop, the loop is terminated and program control resumes at the next statement following the loop. Here is a simple example: /** * This program demonstrates * break to exit a loop. */ public class BreakDemo { public static void main(String[] args) { for…

Read More

Static Class Members

In Java you can create a field or method that does not belong to any object of a class. Such are known as static variables or static methods. Static Variable To declare a static variable, you put them in the class just like instance variables, but you put the keyword static in front. Static variables belong to…

Read More