Answers for "str.substring() in java"

9

how to substring in java

class scratch{
    public static void main(String[] args) {
        String hey = "Hello World";
        System.out.println( hey.substring(0, 5) );
        // prints Hello;
    }
}
Posted by: Guest on January-08-2020
1

java get substring

// substring(int begin, int end)
String n = "hello there general kenobi";
System.out.println(n.substring(6, 11));
// -> "there"
Posted by: Guest on March-14-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language