Java String Interview Questions and Answers 1. Introduction The String class is one of the most widely used classes in Java, which prompted language designers to treat it specially. This special behavior makes it one of the hottest topics in Java interviews. In this tutorial, we’ll go through some of… Continue Reading java-string-interview-questions

Concatenating Strings In Java 1. Introduction Java provides a substantial number of methods and classes dedicated to concatenating Strings. In this tutorial, we’ll dive into several of them as well as outline some common pitfalls and bad practices. 2. StringBuilder First up is the humble StringBuilder. This class provides an array of String-building utilities… Continue Reading java-strings-concatenation

Removing Repeated Characters from a String 1. Overview In this tutorial, we’ll discuss several techniques in Java on how to remove repeated characters from a string. For each technique, we’ll also talk briefly about its time and space complexity. 2. Using distinct Let’s start by removing the duplicates from our… Continue Reading java-remove-repeated-char

Remove Leading and Trailing Characters from a String 1. Introduction In this short tutorial, we’ll see several ways to remove leading and trailing characters from a String. For the sake of simplicity, we’ll remove zeroes in the examples. With each implementation, we’ll create two methods: one for leading, and one… Continue Reading java-remove-trailing-characters