i took the second option ,, and IT WORKED ,, :D
Thank u very much for ur time
Type: Posts; User: AlaaAssaf
i took the second option ,, and IT WORKED ,, :D
Thank u very much for ur time
Oops then nw I have two problems
1 the printing issue (it printed when I called the method within the sum2List()method,, but it is not printing when i call it in the main method )
2 reversing the...
OKAAAY I should have called the printList method in the sum2List itself,,
Thank u very much ,,
u helped me point out my misconception
run:
This is the original value of sum 0
This is the sum 7 This is the sum 80 This is the sum 8
List1's elements are
3->2->1->
List2's elements are
4->78 ->7->
List3's elements are
BUILD...
package q3;
public class ListNode {
//variables the data and link to next node
int data;
ListNode next;
//constructor
ListNode(int d, ListNode n){
package q3;
public class ListNode {
//variables the data and link to next node
int data;
ListNode next;
//constructor
ListNode(int d, ListNode n){
package q3;
//class for the nodes
public class ListNode {
//variables the data and link to next node
int data;
ListNode next;
ListNode(int d, ListNode n){
data = d;
next = n;
I already did a complete program there are no errors ,, it is only that the first is pointing to null that is why it is not entering the loop
public class listNode {
int ...
public void add(int d){
listNode l = new listNode (d, null);
l.next = first;
first= l;
}
public list Sum2List (list l1, list l2){
//variables
int sum;