Results 1 to 3 of 3

Thread: java code

  1. #1
    noor is offline Member
    Join Date
    Dec 2009
    Posts
    1
    Rep Power
    0

    Default java code

    good morning

    I'm a new member in this forum, so I hope to accept me.
    I made java program yesterday about union of two sets by using linked list, so I hope from you to see it and check
    wheather is correct or not.


    regards,
    Noor





    import java.util.Scanner;
    public class union {

    public static void main(String[] args)
    {


    Scanner scan = new Scanner(System.in);

    int value=0;

    SLLHeader HeaderNode1 = new SLLHeader();
    SLLHeader HeaderNode2 = new SLLHeader();
    SLLNode current1, newNode1,firstnode1, prevNode1;
    SLLNode current2, newNode2,firstnode2, prevNode2;


    System.out.println("how may numbers you want to enter?");
    int n = scan.nextInt();
    for (int i=1;i<=n;i++){
    System.out.println("Enter the value:");
    value = scan.nextInt();
    }


    newNode1 = new SLLNode( value);
    firstnode1 = HeaderNode1.LTFN;
    HeaderNode1.LTFN = newNode1;
    newNode1.next = firstnode1;




    if (HeaderNode1.LTFN == null)
    System.out.println("The list is empty");
    else {
    System.out.println("The List is:");
    current1 = HeaderNode1.LTFN;
    while (current1 != null) {
    System.out.println(" " +current1.data);
    current1 = current1.next;
    }

    }

    System.out.println("Enter the value:");
    value = scan.nextInt();
    newNode2 = new SLLNode(value);
    firstnode2 = HeaderNode2.LTFN;
    HeaderNode2.LTFN = newNode2;
    newNode2.next = firstnode2;




    if (HeaderNode2.LTFN == null)
    System.out.println("The list is empty");
    else {
    System.out.println("The List is:");
    current2 = HeaderNode2.LTFN;
    while (current2 != null) {
    System.out.println(" " +current2.data);
    current2 = current2.next;
    }

    }




    current1 = HeaderNode1.LTFN;
    prevNode1= current1;
    while (current1 != null) {
    System.out.println(" " +current1.data);
    prevNode1= current1;
    current1 = current1.next;
    }
    current2 =
    prevNode1.next = HeaderNode2.LTFN;
    current2=prevNode1.next;
    while (current2 != null) {
    System.out.println(" " +current2.data);
    current2 = current2.next;
    }


    System.out.println("Enter an appropriate choice");

    }



    }


    class SLLNode {

    int data;
    SLLNode next;

    SLLNode(int data) {
    this.data = data;
    this.next = null;

    }

    }

    class SLLHeader {

    SLLNode LTFN;
    SLLHeader()
    {
    this.LTFN = null;
    }

    }

  2. #2
    chotemiyan is offline Member
    Join Date
    Jan 2010
    Posts
    1
    Rep Power
    0

    Smile Need Urgent Reply...!!

    Respected Members,
    I am a new member here..
    I am running a mobile communication shop.
    Most of the running business is balance transfer or balance sharing. I like to operate my SIM from computer so that I can share/transfer balance to customer and save the report to my computer.
    This product of sharing balance is called "EasyLoad".
    Kindly help in the matter that how can I operate my SIM from computer?
    Thanks

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Hi all, welcome to Java Forums.

    Please choose the correct sub-forum next time to ask your question. This is not the correct place to ask your question. I'll move this to the correct place this time. Please don't re-post it. If you have any question please let me know. Good luck!

Similar Threads

  1. Java code
    By s_dawg101 in forum New To Java
    Replies: 6
    Last Post: 12-02-2009, 08:34 PM
  2. Convert java code to midlet code
    By coldvoice05 in forum New To Java
    Replies: 1
    Last Post: 08-12-2009, 12:14 PM
  3. Convert java code to midlet code
    By coldvoice05 in forum Advanced Java
    Replies: 1
    Last Post: 08-09-2009, 02:21 PM
  4. Java code
    By swain_am in forum New To Java
    Replies: 6
    Last Post: 04-06-2009, 03:33 AM
  5. Need a java code
    By vissu007 in forum New To Java
    Replies: 1
    Last Post: 07-11-2007, 11:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •