Java String Tutorial

A string is the most important topic in all topics of Java. It is also a favorite topic for any interviewer. Whenever you will go for any technical interview, the interviewer always asks questions from string concepts. Here, you will get Java String tutorials with the best example programs and … Read more

String Constructor in Java with Example

Java String Constructor | String class supports several types of constructors in Java APIs. The most commonly used constructors of the String class are as follows: String() String(String str) String(char chars[ ]) String(char chars[ ], int startIndex, int count) String(byte byteArr[ ]) String(byte byteArr[ ], int startIndex, int count) Let’s … Read more

Substring in Java | Methods, Example

Substring in Java is a subset of the main string specified by start and end indices. We can extract substrings by using substring() method. Consider the following example. String str = “Hello, World”; String sub = str.substring(0, 5); // sub is “Hello”. In this example, substring() method obtains a substring … Read more