Java-Scanner

Scanner You saw that it is easy to print output to the console window just by calling System.out.println( ). Reading from the console window isn’t quite as simple. To read console input, you first construct a Scanner that is attached to System.in : Scanner reads formatted input and converts it into its binary form. Scanner can … Read more…

Java-Return

Return The return statement is used to explicitly return from a method. The return statement immediately terminates the method in which it is executed. For example: As you can see, the final println( ) statement is not executed. As soon as return is executed, control passes back to the caller. Program Program Source class Javaapp { … Read more…

Java-Continue Statement

Continue Statement Continue statement is used when we want to skip the rest of the statement in the body of the loop and continue with the next iteration of the loop. For example : This code uses the % operator to check if ‘i’ is odd. If the condition is false, the if statement is … Read more…

Java-Label Break Statement (Exit Labelled Loop)

Label Break Statement (Exit Labelled Loop) Label break statement is used exit from loops. Once you labeled a loop, you can use this label as the target of break statement. When compiler see break statement with label than compiler transfer execution to at end of labeled loop. Progarm Program Source class Javaapp { public static void main(String[] … Read more…

Java-Label Break Statement

Label Break Statement Label break statement is used to transfer control unconditionally from one place to another place in program. Once you labeled a block, you can use this label as the target of break statement. When compiler see break statement with label than compiler transfer execution to at end of labeled block. Program Program … Read more…

Java-Nested For Loop

Nested For Loop The placing of one loop inside the body of another loop is called nesting.  When you nest two loops, the outer loop takes control of the number of complete repetitions of the inner loop. Program Program Source class Javaapp { public static void main(String[] args) { for(int i=0;i<5;i++) { for(int j=0;j<5;j++) { System.out.print(” … Read more…