Java - remove first character from string

0 points
Created by:
Dirask Admin - Marwin

In this article, we would like to show you how to remove the first character from the string in Java.

1. Using String substring() method

In the example below, we use the String substring(int beginIndex) method, where we assign 1 to beginIndex, so we get a string without the first character.

public class StringExample {

    public static void main(String[] args) {
        String text = "This is your text...";
        String substring = text.substring(1);

        System.out.println(substring); // his is your text...


his is your text...


  1. substring() method - Oracle Docs
Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂