SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

CORE API / NOTES</>↗
Core API08 Jul 2006

How do I rename a file or directory?

package org.kodejava.io; import java.io.File; import java.io.IOException; public class FileRenameExample { public static void main(String[] args) throws IOException { // Creates a new file called OldHouses.csv File oldFile = new File("OldHouses.csv"); boolean created = oldFile.createNewFile(); System.out.println("File created? " + created); // Creates the target file. File newFile = new File("NewHouses.csv"); // The renameTo() method renames file […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API05 Jul 2006

How do I check if a file is hidden?

The File.isHidded() method checks to see if the file represented by aFile object is a hidden file. The definition of hidden is varied between operating systems. On UNIX based systems, a file is considered to be hidden when their name begins with a period character ('.'). On Windows operating system, a file is considered to […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API02 Jul 2006

How do I get the content of a directory?

In this example you’ll see how to read the list of files inside a directory. To get this functionality we can use the File.listFiles() method. This method return an array of File object which can be either an instance of file or directory. package org.kodejava.io; import java.io.File; import java.io.FilenameFilter; public class DirectoryContentExample { public static […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API27 Jun 2006

How do I create a new directory in Java?

We create a directory by calling mkdir() method of the File object. This method returns true if and only if the directory was successfully created. If false was returned, no directory is created. This could be caused, for example that the directory was already exists. package org.kodejava.io; import java.io.File; public class CreateDirectoryExample { public static […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API27 Jun 2006

How do I get the absolute path of a file in Java?

The following code snippet shows you how to get the absolute path of a file. To do this we use the java.io.File object getAbsolutePath() method. package org.kodejava.io; import java.io.File; public class AbsolutePathExample { public static void main(String[] args) { // Create an instance of File called file. File file = new File("README.md"); // Now we […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API25 Jun 2006

How do I convert decimal to octal?

From the code snippet below you will learn how to convert decimal to an octal string and converting back from a string of octal number to decimal. For the first conversion we can utilize the Integer.toOctalString() method. This method takes an integer number and will return the string that represent the corresponding octal number. To […]

Wayan · 2 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.