string methods

PHOTO EMBED

Thu Dec 21 2023 23:14:46 GMT+0000 (Coordinated Universal Time)

Saved by @user01

class Methods{
	public static void main(String[]args){
		String s1 = "Hello,world!";
		System.out.println("Length: "+s1.length());
		System.out.println("Index: "+s1.ChartAt());
		System.out.println("Substring: "+s1.SubString());
		System.out.println("contains: "+s1.contains("world"));
		System.out.println("uppercase: "+s1.toUppercase());
		System.out.println("Lowercase: "+s1.toLowercase());
		String s2 = "Hello";
		String s3 = "world";
		System.out.println("concat: "+s2.concat(s3));
		String s4 = "Hello,world!";
		System.out.println("Is equal: "+ s1.equals(s4));
		String s5 = s2.replace('o','X');
		System.out.println("replaced: "+s5);
	}
}	
content_copyCOPY