It is a simple implementation of linked list to split one list into two sublists. Other details have been discarded for simplicity
class SList {
private head;
Object item;
public void split_list(SList list1, SList list2) {
list1.head = this.head;
// Some other stuff
}
}
isn’t it a visibility violation to do assign list1.head? To my surprise, I tried and it worked fine
As per JLS 6.6.8:
It’s the same class.