JAVA RECORD PROGRAM TO UNDERSTAND STRING OPERATIONS
public class StringExample { public static void main(String[] args) { // Creating a string String str = "Hello, World!"; // Length of the string int length = str.length(); System.out.println("Length of the string: " + length); // Getting character at a specific index char ch = str.charAt(7); System.out.println("Character at index 7: " + ch); // Substring String substr = str.substring(7, 12); System.out.println("Substring from index 7 to 11: " + substr); // Converting to uppercase ...


Comments
Post a Comment