Tuesday, April 20, 2010

Simple String program

import java.io.*;

public class javastring sample
{
public static void main(String args[])
{
/* string in java represents the character sequence */

/* create string empty*/

String s1=new String(" ");

/* create new string object whose content whose content whould be "Hello world"*/
String S2=new String("Hello World");


/* getting the length of the string */

System.out.print(s2.length());



}
}

No comments:

Post a Comment