Java examples for Language Basics:String
Extracting substrings from a string
public class Main { public static void main(String[] args) { String s = "Baseball"; String b = s.substring(4);//www . ja va 2s . com System.out.println(b); s = "Baseball"; b = s.substring(2, 6); System.out.println(b); } }