Answers for A2 - Section3

55 views
Skip to first unread message

Giuliana Flores

unread,
Apr 14, 2013, 2:09:22 PM4/14/13
to cs49...@googlegroups.com

Here are my answers:

1) III

2) I and II only

3) B

4) D

5) B

 

Recall:

(For question 2)

·               Public variables: are variables that are visible to all classes.

  • Private variables:  are variables that are visible only to the class to which they belong.
  • Protected variables:  are variables that are visible only to the class to which they belong, and any subclasses.

private - Only the current class will have access to the field or method.

protected - Only the current class and subclasses of this class will have access to the field or method.

public - Any class can refer to the field or call the method.

 

5) fun1() prints the given Linked List in reverse manner. For Linked List 1->2->3->4->5, fun1() prints 5->4->3->2->1.

1) An object is a class variable whose members have been initialized.


Reply all
Reply to author
Forward
0 new messages