Maruthi Krishna has Published 870 Articles

How to find a unique character in a string using java?

Maruthi Krishna

Maruthi Krishna

Updated on 01-Sep-2025 14:11:31

17K+ Views

In this article, we will learn how to find a unique character in a string in Java. A unique character is a character that occurs only once in the string, while all others can occur multiple times. We can solve this problem using the following ways: Using Brute Force ... Read More

How to read the contents of a webpage into a string in java?

Maruthi Krishna

Maruthi Krishna

Updated on 01-Sep-2025 14:11:04

13K+ Views

We can read the contents of a web page in several ways using Java. Here, we are going to discuss three of them. Those are as follows: Using the java.net.URL class. Using the HttpClient library. Using the org.jsoup library. Using the URL class The URL class of the ... Read More

How to check that a string is parse-able to a double in java?

Maruthi Krishna

Maruthi Krishna

Updated on 01-Sep-2025 14:10:42

6K+ Views

Let's learn how to check if a string is parseable to a double in Java. We have multiple ways to do this. Some of them are: Using Double.parseDouble() Using Double.valueOf() Using the constructor of the Double class ... Read More

What is ARM in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 01-Sep-2025 14:03:26

1K+ Views

Automatic resource management(ARM) or try-with-resources is a new exception handling mechanism that we are going to discuss in this article. What is a resource? A resource is an object which implements AutoClosable interface. Whenever you use a resource in your program, it is recommended to close it after use. ... Read More

How to insert a string in beginning of another string in java?

Maruthi Krishna

Maruthi Krishna

Updated on 01-Sep-2025 14:02:49

7K+ Views

Let's learn how to add a string at the beginning of another string in Java. We can do this in the following ways: Using the toCharArray(). Using the String concatenation operator. Using the StringBuilder class. Using the StringBuffer class. Using the toCharArray() toCharArray() method of the String class ... Read More

How convert an array of Strings in a single String in java?

Maruthi Krishna

Maruthi Krishna

Updated on 01-Sep-2025 12:34:09

33K+ Views

In this article, we will learn how to convert an array of strings into a single string in Java. There are several ways to do so. The following are the different ways to convert an array of strings into a single string: Using the StringBuffer class. Using the toString() ... Read More

How can we add an underscore before each capital letter inside a java String?

Maruthi Krishna

Maruthi Krishna

Updated on 01-Sep-2025 12:32:35

3K+ Views

In this article, we will learn how to add an underscore before each capital letter in a Java String. We also call this process as "camel case to snake case" conversion. We can solve this problem using the following ways: Using StringBuffer class. ... Read More

How do we split a string with any whitespace chars as delimiters using java?

Maruthi Krishna

Maruthi Krishna

Updated on 01-Sep-2025 12:30:57

841 Views

What is split() method in Java? The split() method of the String class accepts a delimiter (in the form of a string), divides the current String into smaller strings based on the delimiter, and returns the resulting strings as an array. If the String does not contain the specified delimiter, ... Read More

Can we define constructor inside an interface in java?

Maruthi Krishna

Maruthi Krishna

Updated on 26-Aug-2025 16:30:22

8K+ Views

Interfaces in Java are used for defining a contract that classes can implement. They can contain method signatures, default methods, static methods, and constants. we must implement the methods defined in the interface in the implementing class. Can we define a constructor inside an interface in Java? No, constructors ... Read More

Constructor overloading in enumerations in Java.

Maruthi Krishna

Maruthi Krishna

Updated on 21-Aug-2025 12:36:30

974 Views

Overloading is one of the mechanisms to achieve polymorphism where, a class contains two methods with same name and different parameters. It allows one method to perform different tasks based on the parameters passed to it. Whenever you call this method, the method body will be bound with the method ... Read More

1 2 3 4 5 ... 87 Next
Advertisements