implement selection sort algorithm in java

In this tutorial we will see that how to implement selection sort algorithm in java. The selection sort is a combination of searching and sorting. During each pass, the unsorted element with the smallest or largest value is moved to its proper position in the array. The number of times the sort passes through the … Read more

Connection Pooling in JDBC using Apache Commons DBCP

In this Example We will implement the connection pooling in JDBC using Apache Commons DBCP. Now what is Connection Pool? Connection Pool is a cache of database connections so that connection can be reused when future requests to the database are required. Opening a database connection for each user is a wastage of resource and … Read more

Custom Exception in Java

Custom Exception in Java can be created by Extending the Exception Class. By Creating Custom Exception in Java We can Provide Some Custom Information. Program to Create Custom Exception in Java:- public class TestCustomException { public static void main(String[] args) throws CustomException{ int number = 0; try{ System.out.println(“program to create custom exception in java”); checkException(number); … Read more

Bubble Sort in Java

Bubble Sort in Java in a bubble sorting algorithm, in which elements of the list gradually rise or bubble to their proper location in the array. Bubble sort algorithms cycle through a list, analyzing pairs of elements from left to right, or beginning to end. If the leftmost element in the pair is less than … Read more

Get All Key Values from Properties File

Get All Key Values from Properties File Get All Key Values from Properties File in java using the Properties class Available in java.util Package. The Properties class extends the Hashtable class. From Hashtable, Properties class inherits the Method KeySet() which Returns a Set view of the keys Contained in this Map. Project Structure:- Example to … Read more

Read Properties File using java

To Read Properties File in Java, the Properties Class has a Convenient load Method. That’s the Easiest Way to Read a Java Properties File. Properties are Configuration Values Managed as key/value Pairs. In Each Pair, the key and value are Both String Values. The key Identifies, and is Used to Retrieve, the Value, much as … Read more

Network Interface Addresses Listing

We can get the list of IP addresses that are assigned to it using a network interface. Network interface addresses can be obtained from a NetworkInterface instance by using one of two methods. The first method, getInetAddresses(), returns an Enumeration of InetAddress. The other method, getInterfaceAddresses(), returns a list of java.net.InterfaceAddress instances. This method is … Read more

Get MAC Address using Java

MAC Address can be obtained using the NetworkInterface class. This class represents a Network Interface made up of a name, and a list of IP addresses assigned to this interface. It is used to identify the local interface on which a multicast group is joined. A network interface is the point of interconnection between a … Read more

Delete All Files using Java

To delete all files using java we can simply use the delete() method available in java.io.File package. First we have to list all the file in directory using the File.listFiles() method and then simply use the File.delete() method to delete the files inside the directory. below exapmle demostrates that how to delete all files inside … Read more