Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: how i can do that??

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how i can do that??

    Write a Java function Sum2List that takes two lists L1 and L2 of the same size and returns list L that contains the sum of data inside the corresponding nodes of lists L1 and L2.

  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: how i can do that??


  3. #3
    Member Ganeprog's Avatar
    Join Date
    Jan 2014
    Location
    Chennai,India
    Posts
    80
    My Mood
    Love
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default Re: how i can do that??

    Hi,

    This is very simple. Did you tried anything? Please post here what you tried then ask questions on that.

    Thanks,

  4. #4
    Junior Member
    Join Date
    Apr 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how i can do that??

    Quote Originally Posted by Ganeprog View Post
    Hi,

    This is very simple. Did you tried anything? Please post here what you tried then ask questions on that.

    Thanks,
    i tried this

    public static list ( list L1 , list L2 ){
    list L = new list ();
    listNode temp1=L1.first;
    listNode temp2 = L2.first ;
    listNode temp3 = L.first ;
    while ( temp1 !=null){
    temp3= temp1.data + temp2>data;
    temp3.next=newNode();
    temp1=temp1.next;
    temp2 = temp.next;
    temp 2 = temp3>next ;
    }
    return L;
    }
    but it dosent work in netbean
    " i didnt anitial temp or data becouse i didnt know how and where in this program "
    if any one can help me to write it all with its class , i will be greatfull for him .

  5. #5
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: how i can do that??

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post code correctly. Define "dosent (sic) work." If you're getting errors, post those. If you're getting incorrect results, post those.

  6. #6
    Junior Member
    Join Date
    Apr 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how i can do that??

    still i cant do it

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: how i can do that??

    i cant do it
    Please explain. Copy the program's output and paste it here to show what the program is doing.

    Please edit your post and wrap your code with code tags:
    [code=java]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.