Results 1 to 8 of 8
  1. #1
    bboyinmartin is offline Member
    Join Date
    Jul 2013
    Posts
    18
    Rep Power
    0

    Default Just few questions!

    Can anyone answer these questions for me? I just started learning Java and my book doesn't explain these fully.

    differences between String and string ? (one's in upper-case but one isn't)

    what's the difference between String [] and String? (in the main method)

    and what methods do people commonly use, including the main method?

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,597
    Rep Power
    5

    Default Re: Just few questions!

    String is class which is used to create String objects of type String (sequences of immutable characters).
    string (lower case) is probably a variable but not a Java keyword. string has nothing to do with String unless it was declared as such.
    e.g.
    String string;

    your could also have
    int string; // but it is an unclear declaration.

    String[] is an array which can contain some number of type String.
    I'm reluctant to state what methods are commonly used. It depends on what you want or need to do. Even main may not be considered as commonly used because it is simply a single entry point and not all classes need it.

    If your book does not explain these basic concepts then toss the book!

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    derekxec is offline Member
    Join Date
    Jun 2013
    Posts
    5
    Rep Power
    0

    Default Re: Just few questions!

    just curious what book are you reading?

  4. #4
    bboyinmartin is offline Member
    Join Date
    Jul 2013
    Posts
    18
    Rep Power
    0

    Default Re: Just few questions!

    Sams teach yourself Java sixth edition. It seemed like a good book but the way it's written bit confuses me.

    Anyways, thanks for answering my question!

  5. #5
    bboyinmartin is offline Member
    Join Date
    Jul 2013
    Posts
    18
    Rep Power
    0

    Default Re: Just few questions!

    So in
    public static void main(String[] arguments) {},

    What happens if I just put

    public static void main (String arguments){} ? I tried it, and frankly it worked normally, at least on a simple method.

  6. #6
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Just few questions!

    String is the name of a class. string is probably the name of a variable. Check out the link in my sig for some rules of thumb about names.

    String[] means an array of Strings.

    There are, like, 4,000 methods in the standard API. Nobody knows them all. Get familiar with the organization of the API javadoc. Browse through the packages and get an idea of what's in there so you can look it up when you need it. Java Platform SE 6
    Get in the habit of using standard Java naming conventions!

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,234
    Rep Power
    19

    Default Re: Just few questions!

    Quote Originally Posted by bboyinmartin View Post
    Just few questions!
    Please go through the Forum Rules, particularly the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  8. #8
    khairul is offline Member
    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0

    Default Re: Just few questions!

    Quote Originally Posted by bboyinmartin View Post
    Can anyone answer these questions for me? I just started learning Java and my book doesn't explain these fully.

    differences between String and string ? (one's in upper-case but one isn't)

    what's the difference between String [] and String? (in the main method)

    and what methods do people commonly use, including the main method?

    Litmus test to see diff:

    String[] s1=new String[5];

    System.out.println("First string of s1: "+(s1[0]="stuff"));
    System.out.println("First character of s1: "+s1[0].charAt(0));
    System.out.println(s1);
    System.out.println(s1[0]);

Similar Threads

  1. Two questions!
    By eranmc in forum New To Java
    Replies: 2
    Last Post: 11-09-2012, 03:35 PM
  2. Help for some questions
    By king4oneday in forum Eclipse
    Replies: 1
    Last Post: 02-23-2012, 04:59 PM
  3. questions regarding XML
    By Sparky in forum New To Java
    Replies: 4
    Last Post: 02-01-2011, 07:10 PM
  4. I have 2 questions =P
    By santa in forum New To Java
    Replies: 4
    Last Post: 01-19-2011, 05:35 PM
  5. Questions
    By Csharks in forum New To Java
    Replies: 8
    Last Post: 01-19-2011, 04:11 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
  •