Message from @Paragram Slide - AZ
Discord ID: 495338639429992479
```java
public static void testAddLast() { //passed
System.out.println("------------------testAddLast()----");
init();
list3.add("A");
System.out.println(list3);
list3.add("B");
System.out.println(list3);
list3.add(null);
System.out.println(list3);
list3.add("C");
System.out.println(list3);
drawLine();
}
```
```java
//Add the object e to the end of this list.
// it returns true, after e is successfully added.
public boolean add(Object e) {
ListNode newNode = new ListNode(e);
newNode.next = null;
get(this.size - 1).next = newNode;
this.size++;
return true;
}
```
any glaring problems here?
that get() could return null
hmmm
any ideas on how to fix that?
after init()
how many nodes in list3
println after init()
4
what is size
should be 4
I see
list3.add("C") will throw
because last node was null
and when you get it... and attempt to set next
the data was null, not the node itself I think
ahh ok
it must be the size then
get(this.size - 1) is returning null
```
ListNode last = get(this.size - 1);
if (last != null) {
last.next = newNode;
++this.size;
return true;
}
return false;
```
thanks
this would only happen adding first node to list I would think
what is this class?
data structures?
or Java class?
Data Structures
I actually have a Java developer certificate but it was a long time ago so I have to relearn everything
Got it same time as I graduated high school
when I took that class we used C
1999 😉
Java was its own class back then - the OOP class
I had to take a 3 part Java series to get into this class
It was part of my certificate
nice
it's a good line of work
I need help factoring a math problem @here
-x^2 + 5x + 14
(-x - 2)(x - 7)
I have meeting in 3 mins
but that is close