Java String Example Program – String Java Example

By | December 17, 2010
Java String Example Program - String Java Example. You can find String Java Example Program in this page.

Java String Example Program – String Java Example.

class CheckString{

public static void main(String args[]){

String str=”HELLO guys”;

System.out.println(“The String is:” + str);

System.out.println(“Length of the String is:” +

str.length());

System.out.println(“Character at specified position:”

+ str.charAt(4));

System.out.println(“substring of the String is:” +

str.substring(6,10));

System.out.println(“Index of the specified character:”

+ str.indexOf(“g”));

System.out.println(“conversion to uppercase:” +

str.toUpperCase());

System.out.println(“conversion to uppercase:” +

str.toLowerCase());

}

}

Result:

The String is:HELLO guys

Length of the String is:18

Character at specified position:O

substring of the String is:guys

Index of the specified character:6

conversion to uppercase:HELLO GUYS

conversion to uppercase:hello guys

Leave a Reply

Your email address will not be published. Required fields are marked *