Sponsered Links
Categories
Sponsered Links

Java Substring method example

 

This example illustrates Substring method example. In this example method substring takes the complete data from specified index location of the string under taken in to the String in which the method is invoked, complete value of string str has been copied as zero(0) index location has been passed inside method parentheses.

public class SubstringExample {
  public static void main(String args[]) {

    String str = "java is a platform independent language", str1 = " ", str2 = "jsp servlet";
    str1 = str.substring(0);
   
    System.out.println("value of String str1 taken by the method :   "+ str1);

    System.out.println("value String str2 taken by the method:   "+ str2.substring(3));
  }
}

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved