Capitalize in Java

Published on 11 October 2019 (Updated: 10 October 2022)

Welcome to the Capitalize in Java page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

public class Capitalize {

    public static boolean isLetter(char someChar) {
        return (someChar >= 'a' && someChar <= 'z') || (someChar >= 'A' && someChar <= 'Z');

    public static boolean isUpperCase(char someChar) {
        return (someChar >= 'A' && someChar <= 'Z');

    public static void main(String[] args) {
        if (args.length == 0 || args[0].equals("")) {
            System.out.println("Usage: please provide a string");
        String sentence = args[0];

        char firstChar = sentence.charAt(0);
        if (isLetter(firstChar) && !isUpperCase(firstChar)) {
            char[] charArray = sentence.toCharArray();
            charArray[0] = Character.toUpperCase(firstChar);
            sentence = new String(charArray);


Capitalize in Java was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.