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); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter