1,105,399 Community Members

Got problem on using linked list

Member Avatar
aabbccbryanmark
Light Poster
39 posts since Jul 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 
import java.util.*;

public class LinkedListDemo
{
    public static void main(String[] args)
    {
        LinkedList link=new LinkedList();
        link.add("a");
        link.add("b");
        link.add(new Integer(10));
        System.out.println("The contents of array is" + link);
        System.out.println("The size of an linkedlist is" + link.size());

        link.addFirst(new Integer(20));
        System.out.println("The contents of array is" + link);
        System.out.println("The size of an linkedlist is" + link.size());

        link.addLast("c");
        System.out.println("The contents of array is" + link);
        System.out.println("The size of an linkedlist is" + link.size());

        link.add(2,"j");
        System.out.println("The contents of array is" + link);
        System.out.println("The size of an linkedlist is" + link.size());

        link.add(1,"t");
        System.out.println("The contents of array is" + link);
        System.out.println("The size of an linkedlist is" + link.size());

        link.remove(3);
        System.out.println("The contents of array is" + link);
        System.out.println("The size of an linkedlist is" + link.size());
    }
}

this is the error i got..

--------------------Configuration: <Default>--------------------
Note: C:\Users\Fajutag\Documents\Java Saved Files\LinkedListDemo.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

Process completed.

can someone tell me what should i do on this..

Member Avatar
stultuske
Posting Expert
5,333 posts since Jan 2007
Reputation Points: 938 [?]
Q&As Helped to Solve: 776 [?]
Skill Endorsements: 35 [?]
Featured
 
0
 

either ignore it, or don't use unchecked or unsafe operations ....
if you want more information about what the 'problem' (it's more a remark then a problem, but still) is: do as the message suggests and recompile with the
-Xlint:unchecked
argument.

Member Avatar
aabbccbryanmark
Light Poster
39 posts since Jul 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

but how do i compile with that Xlint:unchecked?..

Member Avatar
subramanya.vl
Junior Poster in Training
82 posts since Oct 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 10 [?]
Skill Endorsements: 3 [?]
 
0
 

its simple

currently you are compiling this way
javac <className.java>

You can add the option "-Xlint:unchecked" during compilation like below

javac -Xlint:unchecked <className.java>

But it is not necessary. You can ignore the message straight away

Member Avatar
stultuske
Posting Expert
5,333 posts since Jan 2007
Reputation Points: 938 [?]
Q&As Helped to Solve: 776 [?]
Skill Endorsements: 35 [?]
Featured
 
0
 

or you add that argument as compile argument in the ide you use.
but, as mentioned before, it is rather a remark. the application does compile and run.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article