JAVA-19
Q.19 . You are given a stingstr=”SDJInternationalCollege”.Perform the following operation on it
Solution
public class StringOperations {
public static void main(String[] args) {
String str = "SDJInternationalCollege";
// Find the length of the string
int length = str.length();
System.out.println("Length of the string: " + length);
// Replace the character 'e' by 'E'
String replacedStr = str.replace('e', 'E');
System.out.println("String after replacing 'e' with 'E': " + replacedStr);
// Convert all characters to uppercase
String upperStr = str.toUpperCase();
System.out.println("String in uppercase: " + upperStr);
}
}