|
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));
}
}
|
|