public class stringmethods {
public static void main(String[] args) {
String name = "Mohamed Abdirizak Ali";
System.out.println("Name: " + name);
System.out.println("Uppercase: " + name.toUpperCase());
System.out.println("Lowercase: " + name.toLowerCase());
System.out.println("First char: " + name.charAt(0));
System.out.println("Length: " + name.length());
System.out.println("Last char: " + name.charAt(20));
System.out.println("Your name: " + name.substring(0, 7));
System.out.println("Your Father name: " + name.substring(8, 17));
System.out.println("Your surname is: " + name.substring(18, 21));
}
}
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