2-21 StringLength

posted Jan 23, 2014, 3:23 AM by Dlovan ismail   [ updated Jan 23, 2014, 3:23 AM by Karwan Jacksi ]
// This program demonstrates the String class's length method.

package stringlength;

public class StringLength 
{
    public static void main(String[] args)
    {
            String name = "Herman";
            int stringSize;
            stringSize = name.length();
            System.out.println(name + " has " + stringSize + " characters.");
    }   
}
ċ
StringLength.java
(0k)
Karwan Jacksi,
Jan 23, 2014, 3:23 AM
Comments