This post will discuss how to remove the first character from a String in Java.

Since Strings are immutable in Java, you can’t remove any character from it. However, you can create a new instance of the string without the first character.

 
The standard solution to return a new string with the first character removed from it is using the substring() method with the beginning index 1. This will create a substring of the string from position 1 till its end.

Download  Run Code

 
It is often needed to remove the first character only if it is a specific character. You can do so by checking if the string starts with the specific character before calling the substring() method. This is demonstrated below:

Download  Run Code

That’s all about removing first character from a String in Java.