Monday 7 May 2012

Java String toLowerCase Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
String class toLowerCase method example

String class toLowerCase method example:- 
This example demonstrates the working of toLowerCase method example. this method returns completly formated data from uppercase to lower case.

Syntax:-toLowerCase() 


Here is the code:-
/**
 * @(#) ToLowerCaseString.java 
 * ToLowerCaseString class demonstrates the working of toLowerCase() method of String class of lang package
 */


public class ToLowerCaseString {
  public static void main(String args[]) {
    //method converts all letters of String in to lower case letters
    //method cannot be invoked while working with CharSequence interfaces
    String heram = "MARYADA PURUSHOTTAM RAM";
    System.out.println(" formatted value of string 'heram' is:     "
        + heram.toLowerCase());

    String krishna = new String("JAI_MAHA_KAAL"), meghnaath = "";
    meghnaath = krishna.toLowerCase();
    System.out.println(" formatted value of string 'krishna' is:     "
        + meghnaath);

  }
}
Output of the program:-
-----------------------
 formatted value of string 'heram' is:     maryada purushottam ram
 formatted value of string 'krishna' is:     jai_maha_kaal

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...