This example shows how to remove duplicate from ArrayList using Comparator. The easiest way to remove duplicate is by passing…
Switch-Case statement in Java
Switch case is another alternative for if-else statements. Switch case statement compares value in the object in the expression with…
If-then and if-then-else Statements in Java
If-else statement in java is used for conditional checks for decision making. You can have multiple hierarchies of if-else statements.…
Set JAVA_HOME Environment Variable Mac Os x
In this tutorial, we show you how to set $JAVA_HOME environment variable on your Mac OS X. Mac OSX 10.5.x…
Covariant return type example in java
In Java 5, we have feature called covariant return type. Prior to Java5, we could not change the return type…
Invoke Method Using Java Reflection
Java provides a reflection API to do an introspection of an object and modify its behavior on the run time.…
How to Create a Text File in Java
In this article we will see how to create a text file in java. In this example, we’ll use the PrintWriter class.…
Copying the Contents of One text file to Another in Java
In this example, we will see a sample program to copying the contents of one text file to another in…
Copy file from one folder to another in java
This example explains how to Copy file from one folder to another in java. package com.javatechig; import java.io.File; import java.io.FileInputStream;…
How to delete and rename a file in java
This post provides sample program explaining how to delete and rename a file in java Rename file in Java package com.javatechig;…