Java - Write code to check if a string has All Letters

Requirements

Write code to check if a string has All Letters

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String str = "book2s.com";
        System.out.println(hasAllLetters(str));
    }//from   w w w.  ja v a2s.c  o  m

    /**
     *
     * @param str         The String.
     *
     * @return true if the string is all letters.
     *
     */
    public static boolean hasAllLetters(String str) {
        int i;
        for (i = 0; i < str.length(); i++)
            if (!isLetter(str.charAt(i)))
                return false;

        if (str.length() == 0)
            return false;

        return true;
    }

    /**
     *
     * @param  ch         The Character.
     *
     * @return true if the character is a capital or lowercase letter.
     *
     */
    public static boolean isLetter(char ch) {
        if (ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z')
            return true;

        return false;
    }
}