Java examples for Language Basics:String
Get Sub string from whole string
public class Main { public static void main(String args[]){ String name="Hello World"; //from w ww .j av a 2s . co m /*print the substring starting from index 6*/ System.out.println(name.substring(6)); /*print the substring starting from index 0 upto 4 not 5. startIndex is inclusive while endIndex is exclusive. */ System.out.println(name.substring(0,5)); } }