How to check if the first-letter of a string is uppercase in Java

2 Answers

0 votes
package javaapplication1;
 
public class JavaApplication1 {
 
    public static void main(String[] args) {
 
        String s = "Java programming language"; 
                
        if (Character.isUpperCase(s.charAt(0)))
            System.out.println("UpperCase");
    }
}
 
 
/*
 
run:
                    
UpperCase
  
*/

 



answered Feb 4, 2017 by avibootz
0 votes
package javaapplication1;
 
public class JavaApplication1 {
 
    public static void main(String[] args) {
 
        String s = "Java programming language"; 
                
        if (Character.isUpperCase(s.codePointAt(0)))
            System.out.println("UpperCase");
    }
}
 
 
/*
 
run:
                    
UpperCase
  
*/

 



answered Feb 4, 2017 by avibootz

Related questions

1 answer 224 views
1 answer 309 views
1 answer 264 views
1 answer 274 views
1 answer 302 views
...