Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

 

and many more ....

 

 

Sum Array of Numbers with for loop

This is an example of how to get the sum of the numbers in an array using a for loop. The for statement provides a compact way to iterate over a range of values. Getting the sum using a for loop implies that you should: Create an array of numbers, in the example int values. Create a for statement, with an ...

Read More »

Check for Palindrome Number with for loop

In this example we shall show you how to check if a palindrome number exists in an array, using a for loop. A palindrome number is a number that is equal to its reverse number. To check if a palindrome number exists in an array, using a for loop one should perform the following steps: Create an array of the numbers ...

Read More »

Generate Prime Numbers with for loop

With this example we are going to demonstrate how to generate prime numbers with a simple for loop. A prime number is a number that has no positive divisors other than 1 and itself. In short, to generate a prime number using a for loop you should: Create a for statement with an int i variable from 1 to a ...

Read More »

Simple for loop

This is an example of a simple for statement. The for statement provides a compact way to iterate over a range of values. Programmers often refer to it as the “for loop” because of the way in which it repeatedly loops until a particular condition is satisfied. Creating a simple for loop implies that you should: Create a for statement with an ...

Read More »

Calculate Fibonacci Series with for loop

In this example we shall show you how to calculate Fibonacci series using a for loop in Java. To calculate Fibonacci series with for loop one should perform the following steps: Create a long array with the numbers to be calculated. Create a for statement where the Fibonacci numbers are calculated and stored in the array. Then in another for statement ...

Read More »

Simple while loop

With this example we are going to demonstrate how to use a simple while statement in Java. The while statement continually executes a block of statements while a particular condition is true. In short, to use a simple while loop you should: Create a while statement that evaluates an expression, which must return a boolean value and has a statement. ...

Read More »

Break Statement

This is an example of how to use the break statement. The break statement can be used to terminate a for, while, or do-while loop. In the example the break statement is used when checking an array’s elements, as described: Create a for statement with an int index from 0 up to an int array length, that checks the elements ...

Read More »

Continue Statement

In this example we shall show you how to use the continue statement. The continue statement skips the current iteration of a for, while , or do-while loop. In the example the continue statement is used when checking an array’s elements, as described: Create a for statement with an int index from 0 up to an int array length, that ...

Read More »

Compare integers

With this example we are going to demonstrate how to compare integers. The comparation between two integers can be performed using the greater than and less than symbols. In short, to compare two integers i1 and i2 you should: Check if i1 is greater than i2 in an if statement. If it is true, that means that i1 is greater ...

Read More »

Simple if/else statement

This is an example of how to use a simple if-else statement. The if-else statement is the most basic of all the control flow statements. It tells your program to execute a certain section of code only if a particular test evaluates to true. Using a simple if-else statement to check in a boolean variable implies that you should: Create ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns