Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-06-2008, 10:00 AM
Member
 
Join Date: Feb 2008
Posts: 2
ramitmehra123 is on a distinguished road
ArrayList
I had a doubt concerning ArrayList

If i want to add strings to an ArrayList is it required to have done a
ArrayList prodSku = new ArrayList();

or

will it work fine with

ArrayList prodSku

at the end i want to do

prodSku.add("abc");
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-07-2008, 02:47 AM
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
Code:
// This is a declaration. // The reference "prodSku" is null, ie, does not // point to or refer to an object. ArrayList prodSku // This is a declaration and instantiation. // Now the reference "prodSku" points to an ArrayList. ArrayList prodSku = new ArrayList(); // This is okay after "prodSku" has been // initialized to point/refer to an ArrayList. // Otherwise this line will generate a // NullPointerException at compile time. prodSku.add("abc");
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Project Trouble: Searching one ArrayList with another ArrayList BC2210 New To Java 2 04-21-2008 01:43 PM
ArrayList kizilbas1 New To Java 1 01-12-2008 10:48 PM
ArrayList kizilbas1 New To Java 11 12-05-2007 09:30 PM
New to arraylist kleave New To Java 2 11-19-2007 08:45 PM
Help ArrayList.add() eNine New To Java 2 08-06-2007 03:13 PM


All times are GMT +3. The time now is 07:26 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org