Menu
Coddy logo textTech

Uppercase & Lowercase

Lesson 8 of 16 in Coddy's Strings and Arrays in Java course.

Let's play with cases!

Use toUpperCase() to convert a string to uppercase letters,

String example = "Hello World";
String upper = example.toUpperCase();

In the above example, upper will hold the string "HELLO WORLD".

Use toLowerCase() to convert a string to lowercase letters,

String example = "HelLO WOrld";
String lower = example.toLowerCase();

In the above example, lower will hold the string "hello world".

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

challenge icon

Challenge

Easy

Write a function named capitalizeStart that gets a string as an argument and returns the same string, but the first character should be capitalized (in uppercase).

Try it yourself

class CapitalizeStart {
    public static String capitalizeStart(String s) {
        // Write code here
    }
}

All lessons in Strings and Arrays in Java