Wednesday, 25 May 2011

substring example in java

public class SubstringExample1{
    public static void main(String[] args){
        String string = "sateesh bagadhi";
        System.out.println("String : " + string);
        String substring = string.substring(3);
        System.out.println("String after 3rd index: " + substring);  
        substring = string.substring(1, 2);
        System.out.println("Substring (1,2): " + substring);
    }
}

No comments: