Skip to content
  • Learn Java
  • About
  • Contact Java With Umer
Java With Umer

Java With Umer

Free java programming knowledge

Tutorial

Enhanced for Loop (Lesson-21)

December 23, 2019August 25, 2018 by umer

In the previous lesson you learnt how you can use loops to cycle through arrays. There is a loop called enhanced for loop which is used to traverse the elements of the array. The syntax of enhanced for loop goes something like this: DataType arrayName; //initialize the array for (DataType temporaryVariable : arrayName) { /* … Read more Enhanced for Loop (Lesson-21)

Categories Tutorial Tags Tutorial Leave a comment

Reading/Writing Arrays (Lesson-20)

December 23, 2019August 20, 2018 by umer

We usually use loops to read from or write to an array. Let’s revise something from the previous lesson. To set elements of an array, we use arrayName[index] = value ; and to read those values, we use output = arrayName[index] ; So, if we use a loop to cycle through that index, we will … Read more Reading/Writing Arrays (Lesson-20)

Categories Tutorial Tags Tutorial Leave a comment

Arrays (Lesson-19)

December 23, 2019August 19, 2018 by umer

An array is a collection of variables of the same DataType. You use array to store many things of the same kind. For example, if you want to store a list of numbers, you can use an int array. Arrays are defined in the following format: DataType[ ] arrayName ; For example, to define an … Read more Arrays (Lesson-19)

Categories Tutorial Tags Tutorial Leave a comment

break and continue (Lesson-18)

December 23, 2019August 14, 2018 by umer

The break and continue statements are used in the loops to alter the way they normally work. Let’s start with the break; statement. Whenever a break; statement is encountered inside the loop, it ends the loop. The control goes outside the loop and all the remaining statements inside the loop are skipped. Let us consider … Read more break and continue (Lesson-18)

Categories Tutorial Tags Tutorial Leave a comment

Nested loops (Lesson-17)

December 23, 2019August 9, 2018 by umer

A loop inside a loop is called a nested loop. Let’s take an example to display a square of asterisk on the screen. We will input the height of the square from the user. *Type the above code yourself in the IDE, execute it and see its output In the above code, the outer loop determines … Read more Nested loops (Lesson-17)

Categories Tutorial Tags Tutorial Leave a comment

do while loop (Lesson-16)

December 23, 2019August 8, 2018 by umer

A do while loop works much like a while loop. The only difference is that it executes at least once. Did’nt get that? An example will explain it better. In the above example, we used while loop and as the condition given to the while loop was already false, the code in the body of … Read more do while loop (Lesson-16)

Categories Tutorial Tags Tutorial Leave a comment

for Loop (Lesson-15)

December 23, 2019August 6, 2018 by umer

As you already know that loops are used to execute a set of statements many number of times. for loop is handy if we already know that how many times the loop will execute. Syntax for for loop is: for (initialization ; condition ; incement/decrement) { //Body of loop } In initialization, we initialize a … Read more for Loop (Lesson-15)

Categories Tutorial Tags Tutorial Leave a comment

while loop (Lesson-14)

December 23, 2019August 3, 2018 by umer

In any programming language, loops are used to execute a set of statements many number of times. A while loop gets a condition and a block of code (called the body of the loop). It will continue executing the block of code again and again as long as the condition is true. Syntax of while … Read more while loop (Lesson-14)

Categories Tutorial Tags Tutorial Leave a comment

switch Statement (Lesson-13)

December 23, 2019August 1, 2018 by umer

We have been doing decision making by using if statement. The switch statement is also used for decision making. To understand the switch statement, let’s consider a problem. We will first solve this problem by using if and then we will solve this problem by using switch statement. Let us consider a program that will … Read more switch Statement (Lesson-13)

Categories Tutorial Tags Tutorial Leave a comment

else if Statement (Lesson-12)

December 23, 2019July 31, 2018 by umer

You learnt about if statement. This lesson is just an add-on to what you have already learnt. Let us consider if you want to test multiple conditions on the same thing. The first way to do this is by using multiple if statements. Let us consider a problem for understanding. Our program should input the … Read more else if Statement (Lesson-12)

Categories Tutorial Tags Tutorial Leave a comment
Post navigation
Older posts
Newer posts
← Previous 1 2 3 4 Next →

Android App

Categories

  • Android
  • Codes
  • How to
  • Linux
  • Tutorial

Recent Posts

  • What is Ellipsize in Android?
  • How to get value from EditText in Android
  • Java program to reverse a sentence
  • Set EditText to input Numbers only
  • Java program to convert Binary to Decimal
  • Privacy Policy
  • Terms and Conditions
  • Disclaimer
© 2025 Java With Umer • Powered by GeneratePress