Working with String in Java


Strings are used for storing text and have many useful methods for manipulation.

Source Code

public class StringExample {
    public static void main(String[] args) {
        String greeting = "Hello, World!";
        System.out.println("String length: " + greeting.length());
        System.out.println("Uppercase: " + greeting.toUpperCase());
        System.out.println("Substring: " + greeting.substring(0, 5));
    }
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments