Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / July 2006

Tip: Looking for answers? Try searching our database.

LinkedList newbie

Thread view: 
justplain.kzn@gmail.com - 31 Jul 2006 20:31 GMT
Hi,

Please correct me if I am off the beaten path. I am new to java and I
am trying to use LinkedLists.
I created a class Transaction as my data storage object. I have a class
checkBook that attempts to write create a linkedlist of transactions.
Attached are the 2 files:
public class Transaction
{
    Transaction()
    {
        transType="";
        accntTotal=0;
    }

    public void setTransType(String newTransType)
    {
        transType = newTransType;
    }

    public String getTransType()
    {
        return transType;
    }

    private String transType;
    private double accntTotal;
}

import java.util.*;
public class chequeBook
{
    public void chequeBookList()
    {
        LinkedList tranList = new LinkedList();
//        ArrayList tranList = new ArrayList();
        Transaction financialTrans = new Transaction();
        financialTrans.setTransType("Deposit");

        tranList.add(financialTrans);
//        System.out.println(tranList.peek().getTransType()+ " from peek");
    }

    public static void main (String args[])
    {
        chequeBook chkbook = new chequeBook();

        System.out.println("In main method.");
    }
}

When attempting to run this little test proggie I get the following:
chequeBook.java:12: warning: [unchecked] unchecked call to add(E) as a
member of
the raw type java.util.LinkedList
               tranList.add(financialTrans);

I am totally lost and would greatly appreciate if someone could point
out and explain the warning message.

Thanks in advance...
justplain.kzn@gmail.com - 31 Jul 2006 20:48 GMT
got it - just needed to RE-READ the documentation more carefully .

Thanks...

> Hi,
>
[quoted text clipped - 57 lines]
>
> Thanks in advance...
IchBin - 31 Jul 2006 20:49 GMT
> Hi,
>
[quoted text clipped - 57 lines]
>
> Thanks in advance...

You need to look at Generics in the 1.5 Docs..

http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA              http://weconsultants.phpnet.us
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.