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: Quick question

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Thanked 0 Times in 0 Posts

    Default Quick question

    What is the difference between

    ArrayList myList = new ArrayList();


    List myList = new ArrayList();

    And why(if it is) is one more beneficial than the other?

    Im really confused because it seems to me that they both do exactly the same thing

    Thanks in advance~

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

    Default Re: Quick question

    The first myList can use all the methods of the ArrayList class
    The second myList can only use the methods of the List class.

Similar Threads

  1. quick question, please HELP!
    By Nemus in forum What's Wrong With My Code?
    Replies: 14
    Last Post: September 29th, 2011, 01:23 PM
  2. Quick Question
    By sird00dguyman in forum Java Theory & Questions
    Replies: 2
    Last Post: August 4th, 2011, 06:14 PM
  3. Another Quick Question
    By Jacksontbh in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 1st, 2011, 07:18 AM
  4. Hi, quick question
    By curras in forum Member Introductions
    Replies: 1
    Last Post: March 21st, 2011, 03:21 PM
  5. quick question - new keyword
    By bbr201 in forum Java Theory & Questions
    Replies: 2
    Last Post: July 18th, 2010, 09:43 PM