What can be the error in this simple Linked List Implementation

i have a linked list code that wont compile successfully. The code is
//Lets try the Linked List 
import java.util.*;
class LinkedListDemo {
public static void main ( String args[]){
     LinkedList l1=new LinkedList();
     l1.add( "A");
     l1.add(2);
     l1.add(3);
     l1.add(4);
     l1.add(5);
     l1.addFirst(6);
     l1.add(7);
     l1.add(8);
     l1.add(9);
     //Lets check what does the Linked List hold at this time
     System.out.println("Prsently the linked lis is having:  "+l1);
}Problem is with the add method . Compiler error is that it doesnt recognize the symbol ie add method.

i m sorry , java version is 1.4In that case, read up on the link jverd posted on AutoBoxing. You can only add Objects to a List. An int is a primitive, not an Object. You can try something like this:
l1.add(new Integer(2));

Similar Messages

  • Error in executing the program,what can be the error

    Error in executing the program.
    What can be the error ,if the error shown is PROGRAM ABC DOE! after entering the values in selection screen?

    Hi,
    Use find to search globally for message in the program.
    Check the message that is handled in the program in the selection screen validations.Double click and find out the message.Then you can easily trace why it's happening.

  • What can be the cause of this??? [Cannot obtain system-specific informatio]

    JVMCI114: Cannot obtain system-specific information
    JNI_SVR_SNC_03-0.ksh[8]: 1462378 Illegal instruction(coredump)

    what can be the cause of this??? Pointer/memory problem in your C/C++ code.

  • A new top level site was created successfully but won't launch. What can be the cause for this?

    A site collection was created with the URL intranet.contoso and it was added to the DNS as intranet.contoso. The top-level site was created successfully after that with the URL being
    http://intranet.contoso/main but it is not launching and the following is the error message -
    This page can't be displayed.
    This will be a production environment so disabling the security loopback will not be an option. Any suggestions?
    Many Thanks,

    I can connect only to the SharePoint Central Administrator from the client computer but not the top level site.
    The error i'm getting is This page can't be displayed.
    Make sure the web address http://contonsoportalis correct
    Look for the page with your search engine
    Refresh in a few minutes
    Fix connection problems - When clicked the following shows up "Make sure the computer or device is turned on and connected to the network" Windows can't find contosoportal. If the computer or device you are trying to reach is nearby,
    make sure it is turned on and connected to the network. Otherwise contact your network administrator for assistance.
    The DSN already had a host created for an intranet that is running SharePoint 2010 called intranet so I created a new host (A and AAA) named it Portal insert the ip address of the new sharepoint 2013 server but it still didn't work.
    This is the configuration shown in the DNS
    Host A Tab -
    Host (uses parent domain if left blank)
       Portal.contoso.local
    IP address: 192. X.X.X for the SharePoint Server
    ( Should I create a CNAME instead of a new host for the portal? )
    I added the host names in the register but it still does not work....
    It's a virtual environment running on top of hyper V - One server for SharePoint another for SQL and both joined to the DC.

  • HT1349 When I send a text, it goes through as "text message" instead of an "imessage" and the person has an iphone. What can be the cause of this problem?

    When I send a text, it goes through as a "text message" instead of an "imessage" and the person I am texting has an iPhone. what could be the cause of this problem?

    It's not enough for the other person to just have an iPhone. They must be on iOS 5, have iMessage enabled and connected to the Internet.

  • Photoshop CS4 for Mac What can cause the error: Plug-in failed to load - NO VERSION

    With Photoshop CS4 for Mac I install the Kodak Plug-in DIGITAL GEM Airbrush Professional v2.1.0. When Photoshop starts I get an error:
    Plug-ins that failed to load:
       DIGITAL GEM Airbrush Professional v2.1.0 NO VERSION -  - from the file “DigitalAIRProv2.plugin”Flash:
       Connections
       Kuler
    This plug-in works fine on my Mac Pro with Photoshop CS4 and OS 10.6 but fails on a new Macbook Air.
    Reinstalling the plug-in did not make any difference. What can cause this error?

    Thanks Chris, That was my first thought too but this same plug-in works on another installation of CS4. This is a Mac installation and the plug-in is Universal so it should work. Is there any other possible cause for this error? Would Photoshop refuse to load a plug-in in a low memory situation?
    Also, The Flash extensions:Connections and Kuler are working OK, I just copied a little more out of the System Info report than I needed to.

  • ALL IP SLAs to dmVPN spokes give invalid RTT=1 . Nodes use NTP. What can be the reason for this?

    IP SLA Measurements are invalid. RTT should be 20 to 60ms, but IP SLAs deliver RTT=1ms. This applies for UDP Jitter and UDP echo IP SLAs.
    Nodes use NTP time.

    you can use any router you want - I use a netgear others belkin - up to you.
    If you like a post, or want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side of the post.
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • What can be the error as SBL-DAT-00279

    Error for access denied..

    I'm getting the same error trying to Batch Book Assignment for leads with the Administrator role. I'm using the default OOB profile/ and no change was made to it. The user has full access on the Book User membership and is also a manager (part of reports to chain). So what other reason for Access Denied?

  • Plz tell me the error at this simple program

    at this orogram i want the user to input the number and then he get th factorial...
    my program is:
    import javax.swing.JOptionPane;
    public class Ch4_32a
    public static void main (String[]args)
    int f=1, i=1,N;
    String E;
              String M = JOptionPane.showInputDialog("Enter the number");
              N=Integer.parseInt(M);
              while(i<=N);
                   f=f*i;
                   i++;
              JOptionPane.showMessageDialog(null,"the factorial is"+E);
              f=Integer.parseInt(E);
    ******and when i copile it the result is:
    C:\Documents and Settings\F A M I L Y\Desktop\MyProgs\azza\Ch4_32a.java:22: variable E might not have been initialized
              JOptionPane.showMessageDialog(null,"the factorial is"+E);
    ^
    1 error
    it tell me to init the value of E but ir is a string,,
    so plz help me to get the real error

    i delete the (parseInt{) and compile it completle
    but when i excut it the firs widow appear (Ent the number)
    i Enter the number and then "ok" but the second window don't appear which well tell me the result({f)                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • What will be the output of this simple programm ?

    Class ABC
    public static void main(String args[])
    long i = 22222222222222222;
    System.out.println(i);
    Pls give me how to get rid of this problem.
    (Casting to long also doesnot make any effect.)
    I think range of long is very big..although i donot know exactly but bigger than what i wrote.
    so why this problem occurs that "value out of range."
    waiting...
    J stands for Java ONLY

    Change Class to class, then do this:
    long i = 22222222222222222L;

  • What can be the cause of Web ADI error : Cannot execute SQL statement?

    I created a custom integrator in r12.2.3 and while loading I encountered an error, Cannot execute SQL statement.
    I checked my setup in Interface attribute , the RUN_ID column has a default type SQL QUERY with a default value SELECT  XXCONV_EAM_ASSET_NUM_S.NEXTVAL FROM DUAL.
    If I have a right setup here, what can be the cause of this error?

    Hi,
    The possibilities can be of various reasons, with the sql statements,
    xml descriptors, data sources, improper drivers anything. To crack down
    the solution, kindly let me know the error messages and what exactly are
    you trying to accomplish.
    Thanks & Regards
    Raj
    manimaran t wrote:
    what may be the cause of this error java.sql.SQLException: invalid sql
    type passed to callable statement in iplanet ussing JNDI
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • Some processes (like iTunes, QTKitServer Safari Web Content) stop responding more and more often in OSX Mavericks. What can be the source of that?

    I have a rMBP mid-2012 with OSX 10.9 and some processes (e.g. iTunes, QTKitServer Safari Web Content) appear in red in the Activity Monitor, leading to high CPU temperature and low performance. What can be the source of this?

    See this link: https://discussions.apple.com/message/23933863#23933863
    What I do is turn on the Activity Monitor with a search for qt, and I continue to "force quit" the process.

  • I have an iPod Touch version 4.2.1, and whenever iTunes tries to sync my iPod, I get an error message saying "Mobile Backup has encountered a problem and needs to close", and the sync fails.  What can I do to fix this problem?

    I have an iPod Touch version iOS 4.2.1, 8 G capacity, and whenever iTunes tries to sync my iPod, I get an error message saying "Mobile Backup has encountered a problem and needs to close", and the sync fails.  I have tried deleting and reinstalling iTunes, and the same thing happens.  What can I do to fix this problem?

    Try:
    iOS: If you can't back up or restore from a backup in iTunes

  • HT204053 I am running Windows 7 and have tried to install iCloud.  No matter what instructions I follow, I still get the error message "This Apple ID is valed but is not an iCloud account."  How can I resolved this?

    I am running Windows 7 and have tried to install iCloud.  No matter what instructions I follow, I still get the error message "This Apple ID is valed but is not an iCloud account."  How can I resolved this?

    I've tried both. First, I tried on my pc, where iTunes had installed iCloud when it last updated. I have iTunes installed on this computer (and on my iPad and iPhone), but that wasn't the issue.
    So I went online, thinking I needed a separate iCloud Apple ID, but it prompted me for my current Apple ID and gave me the message about my ID being "valid" but not an iCloud account," which, lol, was what it had asked me to do in order to create one. I checked, and at least one other user is having the same issue. I'll attempt to copy/paste the Support request url: https://discussions.apple.com/thread/4430653?tstart=0
    Thank you for any help you can give.
    Trish

  • I just got an apple at&t iphone 4 and I have it unlocked. But I want to connect it to t-mobile, so I trimmed my sim card and once the phone was unlocked I inserted the sim and it says no sim, activation error. What can I do to fix this? What is wrong?

    I just got an apple at&t iphone 4 and I have it unlocked. But I want to connect it to t-mobile, so I trimmed my sim card and once the phone was unlocked I inserted the sim and it says no sim, activation error. What can I do to fix this? What is wrong?

    JayleneC wrote:
    Wait.. Everything on iTunes worked, but when I insert my sim it brings me to the start were I have to choose my language, etc... Then it says activation error.. Are you sure it's the sim card?
    As you addressed me that is exactly what I said
    Dodgy trimming ??   get a new micro sim from T-Mobile

Maybe you are looking for