Java input Letter
        Posted  
        
            by 
                xyvyre
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by xyvyre
        
        
        
        Published on 2012-09-30T02:37:54Z
        Indexed on 
            2012/09/30
            9:37 UTC
        
        
        Read the original article
        Hit count: 208
        
java
I'm doing an java activity that if Name start with letter A-G and Ends with Letter H-z the output is invalid heres my code:
System.out.print("Enter your name: ");
String str = in.readLine();
 if(str.startsWith("a" )){
            System.out.print("INVALID!");
        }  if(str.endsWith("h")){
            System.out.print("INVALID!");
        }
This works but how can i implement letter a to g and h to z i already try this [a-g] and it not WORK!
© Stack Overflow or respective owner