easy assignment

1) Given that the variable?list? represents a reference to a linked list. Define a method called ?countNodes? that counts and returns the number of nodes in the list.;2) Given that the variable ?list? represents a reference to a linked list. Define a method called ?delete? that removes the last node in the list.;3) Given that the variable ?button? is a reference to a JButton object. Write the necessary code that registers this object onto a mouse event, such that when the button is clicked the (x,y)location of the mouse pointer is displayed on the DOS screen.