-
Java Basics
Simple Do While loop Java Example
1. Introduction A do-while loop in Java is a control flow statement that executes a block of code at least once, and then repeatedly executes…
Read More » -
for loop
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…
Read More » -
for loop
Simple for loop
This is an example of a simple for statement. The for statement provides a compact way to iterate over a…
Read More » -
break/continue statement
Continue Java Statement
1. Continue Java Statement In this example, we shall show you how to use the continue keyword statement in Java.…
Read More » -
switch statement
Free Flowing Switch Statement
With this example we are going to demonstrate how to create a free flowing switch statement. A free flowing switch…
Read More » -
try/catch/finally
try with resource example
The NewResource code below: public class NewResource implements AutoCloseable{ String closingMessage; public NewResource(String closingMessage) { this.closingMessage = closingMessage; } public…
Read More » -
exceptions
Create custom Exception example
This is an example of how to create and use a custom exception that will be thrown in a specified condition.…
Read More » -
primitives
short
In this example we shall show you how to use a short type in Java. The short data type is a…
Read More » - primitives
-
primitives
double
With this example we are going to demonstrate how to use a double type in Java. The double data type…
Read More »