isDigit & isLetter methods

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Parth Gallen
    New Member
    • Nov 2010
    • 3

    #1

    isDigit & isLetter methods

    Character.isDig it() or Character.isLet ter() in Java.lang work of course, but I had to make my own solution as homework so here they are:


    isDigit method:
    Code:
    static boolean isDigit(char c) {
    return (c <= '9' & c >= '0');
    }
    isLetter method:
    Code:
    static boolean isLetter(char c) {
    return (c <= 'z' & c >= 'a' || c<='Z' & c>='A');
    }
    Are there any other solutions for this thing and is mine bound to work in every condition?
Working...