How to Convert Java Characters From Lowercase to Uppercase

How to Convert Java Characters From Lowercase to Uppercase thumbnail
Java contains functions for comparing, combining and separating strings of text.

The Java programming language comes with many tools for handling text. One of the easiest ways to handle text in Java is to cast the text as a string and use Java's built-in functions for acting upon strings. Converting Java strings between upper- and lower-case characters using such functions is simple.

Things You'll Need

  • Java compiler
Show More

Instructions

  1. Converting Characters to Uppercase

    • 1

      Cast the text in question as a string:

      String basicText = "this text is all lowercase";

    • 2

      Call the function "toUpperCase" on the string:

      String basicText = string.toUpperCase();

    • 3

      Output the text to verify it is all uppercase:

      System.out.println(basicText);

    Converting Characters to Lowercase

    • 4

      Cast the text in question as a string:

      String basicText = "THIS STRING IS ALL UPPERCASE";

    • 5

      Call the function "toLowerCase" on the string:

      String basicText = string.toLowerCase();

    • 6

      Output the text to verify it is all uppercase:

      System.out.println(basicText);

Related Searches:

References

Resources

  • Photo Credit Thinkstock/Comstock/Getty Images

Comments

Related Ads

Featured