Delete File using Java API

Delete file using java with the help of delete method available in package. The File.delete() method return boolean value. if the file is deleted successfully then the delete() method return true, on the other hand if it not able to delete file using java then it returns false. below example demonstrates how to delete … Read more

How to Get Min and Max Value of Primitive Data Types in Java

Java consists of eight primitive data types which are byte, short, int, long, float, double, boolean and char. A primitive is named by a reserved keyword and is predefined by the language. Primitive values do not share state with other primitive values. We can get the min and max value of primitive data types using … Read more

Reflection in Java and It’s Uses

Reflection in java is used to describe code which is able to examine or modify the run-time behavior of applications running in the Java virtual machine. Reflection in java is a powerful technique that enables applications to perform various operations which would be otherwise impossible. We can inspect and dynamically call classes, interfaces, methods, and … Read more

Different Way to Iterate Over Collection in Java

In java there are multiple ways to iterate, loop through, traverse the elements in collection. For example if you want to display the elements, remove the elements in a given collection then you can implement different ways to iterate, loop or traverse on a given collection like iterator, basic for loop, enhanced for loop etc. … Read more

How to Get localhost IP Address in Java

Using the, We can Get the localhost IP Address in Java. To get the localhost IP, We can Use the Code like import; import; public class IPAddress { public static void main(String[] args) { try { InetAddress ip = InetAddress.getLocalHost(); System.out.println(“IP is : ” + ip.getHostAddress()); } catch (UnknownHostException ex) { ex.printStackTrace(); … Read more

Restore MySql DB on Windows using Java

MYSQl is the world’s second most widely used open-source relational database management system. MYSQL RDBMS provides the mysql shell to restore the database, We can invoke the mysql command from command Prompt to restore the database, mysql shell can also be invoked from java using the java.lang.Runtime class. In the example we are going to … Read more

Java: an Overview

JAVA is a programming language and environment that was designed to solve a number of problems in modern programming practice. It is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers “write once, run anywhere” (WORA) … Read more

Zip Files in Java Using Package

Java provides the ‘’ package to compress and decompress the data. To get started, we will need to import the necessary classes from the package. These classes allow us to work with zip files and compress data. In the below example we are using ZipOutputStream and  ZipEntry Class. Both are essential classes in Java’s … Read more