Hi all,
i want to wite an method that can take a String and return boolean , it should return True if the first character of string is an uppercase . Can not using String Apis ?

so how can i do ?

thank !

import java.util.*;
class Upperstr
{   
    static boolean Upper(String s){
       char [] arrs = s.toCharArray();
       String compare = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

       char []xx = compare.toCharArray();
       for(int i=0;i<compare.length();i++){
          if(arrs[0]==xx[i])
            return true;
       }

        return false;
    }



    static Scanner con = new Scanner(System.in);
    public static void main(String...args){

       System.out.print("Enter a string: ");
       String str = con.next();

       System.out.print(Upper(str));    
    }
}

Hope this helps.

NeiXude : thank !

if this solved your problem,dont forget to mark this solved.

NeiXude: don't provide custom-made code, give him hints as to how to solve the problem, and give him the chance to try and learn for himself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.