Core java
- 17 February
How to set style in excel using Apache POI in java
In this post , we will see how to set style in excel using apache poi. You can put cell style with below code: [crayon-67441bf60468e531705148/] Java Program : [crayon-67441bf604695014775425/] When you run above program, you will get following output: [crayon-67441bf604697334614269/] Lets see content of CountriesDetails.xlsx now.
- 15 February
How to write Excel files in java using Apache POI
In this post, we will see how to write excel in java using Apache POI example. About Apache POI project : The Apache POI Project’s mission is to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft’s OLE 2 Compound Document format (OLE2). In short, […]
- 13 February
How to read excel files in java using Apache POI
In this post, we will see how to read excel in java using Apache POI example. About Apache POI project : The Apache POI Project’s mission is to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft’s OLE 2 Compound Document format (OLE2). In […]
- 13 February
How to detect OS in java
In this post, we will see how to detect OS which you are using. You can use System.getProperty(“os.name”) to get current OS name. Sometimes , we need to write logic based on OS, so we get use this logic to detect current OS. Java Program: [crayon-67441bf605f79912509444/] I am using Mac os to run above program. […]
- 13 February
How to get home directory in java
In this post, we will see how to get user profile’s home directory in java. It is quite simple, we can use System.getProperty(“user.home”) to get it. Java program: [crayon-67441bf606745807603245/] When I ran above program, I got below output: [crayon-67441bf60674a449831469/]
- 12 February
How to move file to another directory in java
In this post, we will see how to move file to another directory in java. We will use java.io.File ‘s rename(File dest) to do it. In below example, we will move config_new.properties from /Users/Arpit/Desktop/Folder1 to /Users/Arpit/Desktop/Folder2 . Java Program: [crayon-67441bf60682e757331481/] When I ran above program, I got following output: [crayon-67441bf606831880504368/]
- 12 February
How to rename a file in java
In this post, we will see how to rename a file in java. We can use java.io.File ‘s rename(File dest) method to rename a file. rename method returns true if operation is success else returns false. It can use this method to move a file also. You should always check if rename operation is successful […]
- 06 February
Find start node of loop in linkedlist in java
If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. In this post, we will see how to find start node of loop in linkedlist in java. We have already seen how to detect a loop in linkedlist in java. This is extension of that post. […]
- 06 February
How to make a file read only in java
In this post, we will see how to make a read only file in java. It is very simple. You need to just call java.io.File ‘s  setReadOnly() method. 1) How to make a file read only Java program: [crayon-67441bf606b2b907689565/] When you run above program, you will get following output: [crayon-67441bf606b2e617627496/] 2) How to make it […]