Java - Write code to Return true if the given letter is uppercase.

Requirements

Write code to Return true if the given letter is uppercase.

Demo

/*
 * Copyright (c) 2001-2002, Marco Hunsicker. All rights reserved.
 *
 * This software is distributable under the BSD license. See the terms of the
 * BSD license in the documentation provided with this software.
 *///  w  w w . j ava2  s  .  c o m
 
//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        char letter = 'a';
        System.out.println(isUppercase(letter));
    }

    /**
     * Returns <code>true</code> if the given letter is uppercase.
     *
     * @param letter letter to check for capitalization.
     *
     * @return <code>true</code> if the given letter is uppercase.
     */
    public static boolean isUppercase(char letter) {
        if ((letter < 'A') || (letter > 'Z')) {
            return false;
        }

        return true;
    }
}