Skip to content

Tag Archives: Java-Strings

Given a String “str” in Java, the task is to convert this string to short type. Examples: Input: str = "1" Output: 1 Input: str… Read More
Given a String “str” in Java, the task is to convert this string to byte type. Examples: Input: str = "1" Output: 1 Input: str… Read More
Given a double value val, the task is to set its precision value to a specific decimal places. Examples:   Input: val = 1 Output: 1.0000 Upto… Read More
Compile-Time Resolution of Strings: When Strings are created with the help of String literals and ‘+’ operator, they get concatenated at compile time. This is… Read More
The String hashCode() method returns the hashcode value of this String as an Integer. Syntax: public int hashCode() For Example: import java.io.*;    class GFG… Read More
Given String str containing digits as characters, the task is to convert this given string to integer in Java. Examples: Input: str = "1234" Output:… Read More
Given a String in Java, the task is to convert this String into Integer. Examples: Input: str = "1234" Output: 1234 Input: str = "456"… Read More
Unlike C/C++ Character arrays and Strings are two different things in Java. Both Character Arrays and Strings are a collection of characters but are different… Read More
Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special… Read More
Strings in Java are Objects that are backed internally by a char array. Since arrays are immutable(cannot grow), Strings are immutable as well. Whenever a… Read More
Write a function to check whether two given strings are an Anagram of each other or not. An anagram of a string is another string… Read More
Given a string and a substring, the task is to replace all occurrences of the substring with space. We also need to remove trailing and… Read More
Given a string str, the task is to count all possible sub-strings of the given string that are prefix of the same string. Examples:  Input:… Read More
Given a sorted array of Strings and a String x, find an index of x if it is present in the array. Examples: Input :… Read More
String is a special class in Java. substring() is one of the widely used methods of String class. It is used to extract part of… Read More

Start Your Coding Journey Now!