Maruthi Krishna has Published 952 Articles

How to list the hidden files in a directory in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:21:14

535 Views

The ListFiles() method returns an array holding the objects (abstract paths) of all the files (and directories) in the path represented by the current (File) object.The File Filter interface is filter for the path names you can pass this as a parameter to the listFiles() method. This method filters the ... Read More

How to get the names of the empty directories in a directory in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:20:45

356 Views

The ListFiles() method returns an array holding the objects (abstract paths) of all the files (and directories) in the path represented by the current (File) object.The File Filter interface is filter for the path names you can pass this as a parameter to the listFiles() method. This method filters the ... Read More

How to create object arrays Java? What are their disadvantages

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:15:48

76 Views

Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of Array.Element: Each item stored in an ... Read More

How to get the directories (only) from a folder using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:15:36

735 Views

The ListFiles() method returns an array holding the objects (abstract paths) of all the files (and directories) in the path represented by the current (File) object.The File Filter interface is filter for the path names you can pass this as a parameter to the listFiles() method. This method filters the ... Read More

How to list all files (only) from a directory using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:13:47

2K+ Views

The ListFiles() method returns an array holding the objects (abstract paths) of all the files (and directories) in the path represented by the current (File) object.The File Filter interface is filter for the path names you can pass this as a parameter to the listFiles() method. This method filters the ... Read More

How to read all files in a folder to a single file using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:10:12

7K+ Views

The listFiles() method of the File class returns an array holding the objects (abstract paths) of all the files (and directories) in the path represented by the current (File) object.To read the contents of all the files in a folder into a single file −Create a file object by passing ... Read More

How to search a file in a directory in java

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:09:15

3K+ Views

The List() method of the File class returns a String array containing the names of all the files and directories in the path represented by the current (File) object.In order to search for a file you need to compare the name of each file in the directory to the name ... Read More

How to get the list of jpg files in a directory in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:06:23

791 Views

The String[] list(FilenameFilter filter) method of a File class returns a String array containing the names of all the files and directories in the path represented by the current (File) object. But the retuned array contains the filenames which are filtered based on the specified filter. The FilenameFilter is an interface in ... Read More

How to create Directories using the File utility methods in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:05:09

281 Views

Since Java 7 the File.02s class was introduced this contains (static) methods that operate on files, directories, or other types of files.The createDirectory() method of the Files class accepts the path of the required directory and creates a new directory.ExampleFollowing Java example reads the path and name of the directory to be created, ... Read More

How to convert primitive data into wrapper class using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 06-Feb-2021 04:37:48

985 Views

Java provides certain classes called wrapper classes in the java.lang package. The objects of these classes wrap primitive datatypes within them.Using wrapper classes, you can also add primitive datatypes to various Collection objects such as ArrayList, HashMap etc. You can also pass primitive values over network using wrapper classes.ExampleLive Demoimport ... Read More

Previous 1 ... 3 4 5 6 7 ... 96 Next
Advertisements