Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Integer class

  1. #1
    Junior Member
    Join Date
    Jun 2012
    My Mood
    Thanked 0 Times in 0 Posts

    Default Integer class

    what is the difference between object.add( new Integer(3));
    and object.add(new Integer("3");

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,274 Times in 2,245 Posts

    Default Re: Integer class

    "3" is a String and 3 is an int.

    Read the API doc for the class to see what types of values are allowed in the class's constructor.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    freakycoder (June 27th, 2012)

Similar Threads

  1. Replies: 3
    Last Post: June 17th, 2012, 06:22 PM
  2. Big Integer help
    By ZekeQR in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 18th, 2012, 09:03 AM
  3. Use of Integer.parseInt
    By tarkal in forum Java SE APIs
    Replies: 3
    Last Post: September 8th, 2011, 03:37 AM
  4. Using Integer.parseInt
    By Fraz in forum Object Oriented Programming
    Replies: 1
    Last Post: April 5th, 2010, 07:50 AM
  5. int and Integer
    By chronoz13 in forum Java Theory & Questions
    Replies: 5
    Last Post: December 31st, 2009, 02:20 AM