Wednesday 13 April 2016

Java Tutorial : Java StringBuffer [length() method]

StringBufferDemo.java
/*
 * public int length()
 * 
 * Parameters: 
 * ----------
 * the length of the sequence of characters currently
 * represented by this object
 */
public class StringBufferDemo
{

    public static void main(String[] args)
    {
        StringBuffer sb = new StringBuffer();
        System.out.println("length = " + sb.length());

        sb.append(40);
        System.out.println("length = " + sb.length());

    }
}
Output
length = 0
length = 2
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/StringBufferDemo_length_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/StringBufferDemo_length_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/88e1f032ca4ea5ed8e91e8ffa23db6cb018a79ff/BasicJava/StringBufferDemo_length_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment