-
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/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 » -
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
Java throw Exception Example
In this post, we feature a comprehensive Java throw Exception Example. 1. What is an Exception in Java? Exception is…
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 » -
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 » -
generics
Java Generics Examples
1. Introduction Sun Microsystems included Java Generics in java 1.5 to introduce the type-safety feature while using the collection classes. It…
Read More » -
statics
Static Variable Java Example
1. Introduction This is a static variable Java Example. Static variables are declared with the static word before the type…
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
long
With this example we are going to demonstrate how to use a long type in Java. The long data type…
Read More »