class LNode {
LNode next;
int value;
}
public class asasasa {
public static void main(String ar[]) {
LNode list = new LNode(), list2=list;
list.value = 9;
list = list.next;
list.value = 6;
list.next = null;
while (list2.next != null) {
System.out.println(list2.value);
list2 = list2.next;
}
}
}
* Exception in thread "main" java.lang.NullPointerException at asasasa.main(asasasa.java:10)* Kindly help with the concept and give a simpler code for such linked list