-
if/else statement
Compare integers
With this example we are going to demonstrate how to compare integers. The comparation between two integers can be performed…
Read More » -
if/else statement
Simple if statement
In this example we shall show you how to use a simple if statement. The if-else statement is the most…
Read More » -
try/catch/finally
try/catch/finally InputStream example
This is an example of an InputStream in a try/catch/finally statement. Using try/catch/finally statement to create an InputStream implies that…
Read More » -
exceptions
Checked and Unchecked Exceptions example
In this example we shall show you how to use a checked and an unchecked exception. A checked exception is…
Read More » -
primitives
long
With this example we are going to demonstrate how to use a long type in Java. The long data type…
Read More » -
primitives
float
In this example we shall show you how to use a float type in Java. The float data type is a…
Read More » -
primitives
char
This is an example of how to use a char type in Java. The char data type is a single…
Read More » -
primitives
boolean
With this example we are going to demonstrate how to use a boolean type in Java. The boolean data type…
Read More » -
Enum
Each Enum Instance a different sub-class
In this example we shall show you how to have each enum instance represent a different sub-class. To make each enum…
Read More » -
Enum
Enum for Singleton and Utility class
enum Singleton { INSTANCE; } enum Utility { ; // no instances } Related Article: Java Secret: Using an enum…
Read More »