educational course/tutorialoutlet.com educational course/tutorialoutlet.com | Page 27

IntListElement( int value, IntListElement e) { data = value; next = e; } IntListElement next; int data; } class Main1 { public static void main( String args) { IntListElement e1 = new IntListElement( 1776, null); e1 = new IntListElement( 1984, e1); e1 = new IntListElement( 2001, e1); e1 = new IntListElement( 2013, e1); System. out. println( e1. data); // prints _______ System. out. println( e1. next. next. data); // prints _______ } } 2.( 2 points) Suppose the two println() calls in Main1 above were replaced by the line mystery( e1); and the following method was added to the class Main1, what would be printed? static void mystery( IntListElement list) { if( list!= null) { System. out. println( list. data); mystery( list. next); } } 3.( 0.5 pts) To have some code execute each time a button is pressed you would put the code in the actionPerformed() method of a class that implements ActionListener, let‘ s call it listener, and then A. Pass listener to a method of the button. B. Pass the button to a method of listener. C. Do both A and B.