Let’s print some patterns (using loops)

You can use loops, specially "for" loop to print out different patterns. You will see below how to print something in a row and go to next row when the loop is over. Also how to print a space when you need and looping inside a loop to count the number of rows you need... Continue Reading →

Advertisements

How to print 1 – 100 in Java

There are many ways to print 1-100. The easiest way is to use a loop. In that case you have 3 types of loops to use. Method-1 Method - 2 Method-3 Method-4 (Using Recursion) And there are a lot more ways to print these numbers. Thank you.

Using loops in Java

You can use loops to re-run a particular code segment until it satisfy a certain condition. Basically there are 3 basic types of loops in Java. While loop For loop Do-While loop While Loop Syntax : while(){   } For example : x++ => increment the value of x by one The printing statement will... Continue Reading →

Recursion

What is recursion? Recursion is the method of calling the same function inside the function. This is the modern approach for the loops in programming languages. So I thought of write about recursion before loops. More Zoomed image is given below. Here I have created a function named "find" which returns an integer. It will... Continue Reading →

How to print something on the screen

The word "print" does not mean the printing using a tangible printer. We use that word to tell that we are displaying something on the screen. It is easy in JAVA. System.out.print("Hello Java"); or System.out.println("Hello Java"); Let's identify the important features of the two statements given above. The "S" in the word "System" should be... Continue Reading →

Blog at WordPress.com.

Up ↑