Maruthi Krishna has Published 952 Articles

Write a program to find the first non-repeating number in an integer array using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Aug-2019 13:34:47

2K+ Views

To find the first non-repeating number in an array −Construct count array to store count of each element in the given array with same length and with initial value 0 for all elements.Compare each element in the array with all other elements, except itself.If match occurs increment its value in ... Read More

Write a Java program to find the first array element whose value is repeated an integer array?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Aug-2019 12:56:21

248 Views

To find the first non-repeating number in an array −Construct count array to store count of each element in the given array with same length and with initial value 0 for all elements.Compare each element in the array with all other elements, except itself.If match occurs increment its value in ... Read More

Write program to reverse a String without using reverse() method in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Aug-2019 12:27:11

4K+ Views

You can reverse a String in several ways, without using the reverse() function.Using recursion − Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the ... Read More

How to delete folder and sub folders using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Aug-2019 12:13:29

3K+ Views

The class named File of the java.io package represents a file or directory (path names) in the system. This class provides various methods to perform various operations on files/directories.The delete() method of the File class deletes the file/directory represented by the current File object.This ListFiles() method of the File class ... Read More

How to get file last modified time in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Aug-2019 12:01:30

3K+ Views

He class named File of the java.io package represents a file or directory (path names) in the system. This class provides various methods to perform various operations on files/directories.The lastModified() method of the File class returns the last modified time of the file/directory represented by the current File object. You can ... Read More

How to list out the hidden files in a Directory using Java program?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Aug-2019 11:47:25

371 Views

The class named File of the java.io package represents a file or directory (path names) in the system. This class provides various methods to perform various operations on files/directories.The isHidden() method of the File class verifies weather the (abstract path of) file/directory represented by the current File object, is hidden.The ... Read More

How to write a program to copy characters from one file to another in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Aug-2019 11:24:50

2K+ Views

To copy the contents of one file to other character by characterExampleimport java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class CopyFiles {    public static void main(String[] args) throws IOException {       //Creating a File object to hold the source file       File source = ... Read More

How to get file URI reference in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Aug-2019 11:21:24

3K+ Views

The class named File of the java.io package represents a file or directory (path names) in the system. This class provides various methods to perform various operations on files/directories.In general, an URI (Uniform Resource Identifier) represents a resource. The URI class of Java represents this format You can get the ... Read More

How to create and store property file dynamically in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Aug-2019 11:18:19

3K+ Views

The .propertiesis an extension in java which is used to store configurable application. It is represented by the Properties class in Java, you can store a properties file and read from it using the methods of this class. This class inherits the HashTable class.Creating a .properties fileTo create a properties ... Read More

How to compress and un-compress the data of a file in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Aug-2019 11:11:37

723 Views

Java provides a two classes namely, DeflaterOutputStream and InflaterInputStream for compressing and uncompressing data.Compressing a Single fileTo compress a single file −Create a FileInputStream object, by passing the path of the file to be compressed in String format, as a parameter to its constructor.Create a FileOutputStream object, by passing the ... Read More

Advertisements