Java

Moderators: zibadian
Number of threads: 7818
Number of posts: 18218

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Linked Lists Posted by indianj on 5 Oct 2005 at 8:42 PM
Hey! I just started learning java, and I am using this book called DATA Structures using JAVA. i am wondring if anyone has the sample of the code? if you do please post here.

thanks
harry
Report
Re: Linked Lists Posted by Vilanye on 5 Oct 2005 at 10:29 PM
: Hey! I just started learning java, and I am using this book called DATA Structures using JAVA. i am wondring if anyone has the sample of the code? if you do please post here.
:
: thanks
: harry
:

If you just started learning java, and have no previous programming experience, linked lists will prove to be extremely difficult to learn.

Doesn't your book have code for a linked list?
Just my 2 bits

Report
Re: Linked Lists Posted by indianj on 6 Oct 2005 at 7:42 AM
my book has outline of code. not real programs that would run and give me the output.
Report
Re: Linked Lists Posted by Josh Code on 8 Oct 2005 at 12:06 AM
: my book has outline of code. not real programs that would run and give me the output.
:

import java.util.LinkedList;
 // http://java.sun.com/j2se/1.3/docs/api/java/util/LinkedList.html
 // also try Iterator class

public class LinkedListTest
{
 public static void main(String a[])
 {
    LinkedList LL = new LinkedList();
     LL.add("hello"); // add a new element
     LL.add("This is another element"); 
         // add another element to end of list
     LL.remove(0); // remove first element in list.
     LL.add("Last element in the list");
     System.out.println(LL.toString());
      // print out list
 }
}



Report
Re: Linked Lists Posted by Vilanye on 8 Oct 2005 at 10:59 AM
: my book has outline of code. not real programs that would run and give me the output.
:
Are you looking to create your own Linked List class or just use one from the API?
Just my 2 bits

Report
Re: Linked Lists Posted by indianj on 8 Oct 2005 at 12:50 PM
yes it would be nice if program will run and give me some sort of output.

thanks everyone for helping me.
Report
Re: Linked Lists Posted by Perforated on 11 Oct 2005 at 3:15 AM
: yes it would be nice if program will run and give me some sort of output.
:
: thanks everyone for helping me.
:

If you've just started to learn Java, why don't you start from the beginning and actually learn to write a program that will run and produce output?
Report
program with output Posted by Josh Code on 11 Oct 2005 at 6:01 AM
: yes it would be nice if program will run and give me some sort of output.
:
: thanks everyone for helping me.
:

Hey, copy and paste the code I've given earlier. It should print the list. It should give you the output you want.

Did everyone skip my message?

import java.util.LinkedList;
 // http://java.sun.com/j2se/1.3/docs/api/java/util/LinkedList.html
 // also try Iterator class

public class LinkedListTest
{
 public static void main(String a[])
 {
    LinkedList LL = new LinkedList();
     LL.add("hello"); // add a new element
     LL.add("This is another element"); 
         // add another element to end of list
     LL.remove(0); // remove first element in list.
     LL.add("Last element in the list");
     System.out.println(LL.toString());
      // print out list
 }
}




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.