Maruthi Krishna has Published 951 Articles

Remove all non-alphabetical characters of a String in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 14-Oct-2019 08:54:42

2K+ Views

The split() method of the String class accepts a String value representing the delimiter and splits into array of tokens (words), treating the string between the occurrence of two delimiters as one token.For example if you pass single space “ ” as a delimiter to this method and try to ... Read More

How to convert LinkedList to Array in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 14-Oct-2019 08:51:15

5K+ Views

The toArray() method of the LinkedList class converts the current Linked List object into an array of object type and returns it. This array contains all of the elements in this list in proper sequence (from first to last element). This acts as bridge between array-based and collection-based APIs.Therefore, to ... Read More

How to make an ArrayList read only in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 14-Oct-2019 08:37:04

439 Views

The unmodifiableList() method of the java.util.Collections class accepts an object of the List interface (object of implementing its class) and returns an unmodifiable form of the given object. The user has only read-only access to the obtained list.ExampleFollowing Java program creates an ArrayList object, adds elements to it, converts it ... Read More

How to send data over remote method in java?

Maruthi Krishna

Maruthi Krishna

Updated on 14-Oct-2019 08:33:54

520 Views

RMI stands for Remote Method Invocation. It is a mechanism that allows an object residing in one system (JVM) to access/invoke an object running on another JVM.RMI is used to build distributed applications; it provides remote communication between Java programs. It is provided in the package java.rmi.To write an RMI ... Read More

What are the key steps in read/write from/to a URL connection in java?

Maruthi Krishna

Maruthi Krishna

Updated on 14-Oct-2019 08:26:34

216 Views

The URL class of the java.net package represents a Uniform Resource Locator which is used to point a resource(file or, directory or a reference) in the world wide web.This class provides various constructors one of them accepts a String parameter and constructs an object of the URL class.The openStream() method ... Read More

How to handle EOFException in java?

Maruthi Krishna

Maruthi Krishna

Updated on 14-Oct-2019 08:20:58

1K+ Views

While reading the contents of a file in certain scenarios the end of the file will be reached in such scenarios a EOFException is thrown.Especially, this exception is thrown while reading data using the Input stream objects. In other scenarios a specific value will be thrown when the end of ... Read More

What are the restrictions imposed on a static method or a static block of code in java?

Maruthi Krishna

Maruthi Krishna

Updated on 14-Oct-2019 08:17:47

4K+ Views

static methods and static blocksStatic methods belong to the class and they will be loaded into the memory along with the class, you can invoke them without creating an object. (using the class name as reference).Whereas a static block is a block of code with a static keyword. In general, ... Read More

Can Enum extend any class in java?

Maruthi Krishna

Maruthi Krishna

Updated on 14-Oct-2019 08:14:37

1K+ Views

Enumeration (enum) in Java is a datatype which stores a set of constant values. You can use enumerations to store fixed values such as days in a week, months in a year etc.You can define an enumeration using the keyword enum followed by the name of the enumeration as −enum ... Read More

How to run a JAR file through command prompt in java?

Maruthi Krishna

Maruthi Krishna

Updated on 14-Oct-2019 08:11:42

3K+ Views

For packaging of class files Java provides a file format known as JAR (Java Archive). Typically, a JAR file contains .class files, images, text files, libraries that are required to execute the application or, library.This file format is used to distribute application software and libraries in Java. All the predefined ... Read More

How many types of memory areas are allocated by JVM in java?

Maruthi Krishna

Maruthi Krishna

Updated on 14-Oct-2019 08:06:04

1K+ Views

Java Virtual Machine is a program/software which takes Java bytecode (.class files) and converts the byte code (line by line) into machine understandable code.JVM contains a module known as a class loader. A class loader in JVM loads, links and, initializes a program. It −Loads the class into the memory. Verifies ... Read More

Advertisements