Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » Homework HelpRSS Feeds

Program to show an example of extraction of characters from a StringBuffer objects

Posted By: Brett Smith     Category: Java     Views: 2089

A Java Program to show an example of extraction of characters from a StringBuffer objects.

Code for Program to show an example of extraction of characters from a StringBuffer objects in Java

publicclass JAVA_060
 {
    publicstaticvoid main(String[] args)
    {
       StringBuffer SB=new StringBuffer("Many hands make light work");

       System.out.println("StringBuffer : " + SB);

       System.out.println("Character at position 0 is : " + SB.charAt(0));
       System.out.println("Character at position 5 is : " + SB.charAt(5));
       System.out.println("Character at position 10 is : " + SB.charAt(11));

       char[] cArray=newchar[10];

       SB.getChars(5,15,cArray,0);

       System.out.println("The contents of cArray are : ");

       for(int i=0;i<cArray.length;i++)
          System.out.println(cArray[i]);
    }
 }
  
Share: 



Brett Smith
Brett Smith author of Program to show an example of extraction of characters from a StringBuffer objects is from Sydney, Australia.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!