// Program to explain the following StringBuffer function :
//String substring( int startIndex )
//String substring( int startIndex, int endIndex )class Msubstring1
{
public static void main( String args[ ] )
{
StringBuffer sb1 = new StringBuffer( "Java Programming Examples." );
System.out.println( " String = " + sb1 );
String s1 = sb1.substring( 5 );
System.out.println( " String = " + s1 );String s2 = sb1.substring( 5, 14 );
System.out.println( " String = " + s2 );
}
}
Output:String = Java Programming Examples.
String = Programming Examples.
String = Programmi