Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By Toll

Thread: get a string's first alphabet.

  1. #1
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default get a string's first alphabet.

    how to get a String's first alphabet?
    Java Code:
    String a="abc";
    System.out.print(a);//i want only first alphabet. is there a API for ?

    Edited to Add: ......
    Why
    String a="abc";//why working,but
    char a[]=new char[];//needs decllaration?


    regards
    dhilip
    Last edited by noobplus; 07-13-2013 at 02:02 PM.

  2. #2
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    392
    Rep Power
    4

    Default Re: get a string's first alphabet.

    Have a look at String (Java Platform SE 6) to see how to use strings.

    The second is because "abc" is a String already. And you technically don't need to declare a new char[], you could also use "char[] chArray={'a', 'b', 'c'};" to create a new array of chars with the three values "a", "b" and "c".
    noobplus likes this.

Similar Threads

  1. Replies: 2
    Last Post: 11-08-2010, 08:01 AM
  2. Incremented alphabet
    By ashin in forum New To Java
    Replies: 1
    Last Post: 10-07-2010, 12:36 PM
  3. Java Alphabet problem
    By hailkush in forum New To Java
    Replies: 0
    Last Post: 03-06-2010, 04:11 PM
  4. Alphabet timer help.
    By kosok in forum New To Java
    Replies: 2
    Last Post: 12-24-2008, 06:05 PM
  5. Listing the alphabet (beginner)
    By SuperOnion in forum New To Java
    Replies: 3
    Last Post: 12-22-2008, 03:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •