Your implementation does not allow for an empty list.
- It's a bit odd to only have the constructor which takes a node value.
You should probably implement the
Listinterface.You should look into generics instead of hard-coding your list to only take
ints.It looks like from looking at
insert()that you are trying to create an ordered linked list. However,append()does not. (If you really want to define an ordered linked list, you can still use generics, but you'll have to use types which are children ofComparable).In
insert()anddelete()you have someif-conditions followed by awhile-loop. My guess is that they can be merged in a singlewhile-loop. I was lazy and haven't tried doing it, so it might not be true.
What @toto2 said plus
I would change the
printmethod. OverridetoStringmethod.Do not put
System.out.printlnin an API class. You will be reusing yourLinkedListclass in future in GUI or Web app. Then unwanted SOPs will hamper your code.