Core Java - Interview Questions and Answers

181. If no input parameters are specified in a method declaration then the declaration will include __. empty set of parantheses
b.the term void
Ans: a.

182. What are the functions of the dot(.) operator?

a.It enables you to access instance variables of any objects within a class
b.It enables you to store values in instance variables of an object
c.It is used to call object methods
d.It is to create a new object
Ans: a,b,c.

183. Which of the following can be referenced by this variable?

a.The instance variables of a class only
b.The methods of a class only
c.The instance variables and methods of a class
Ans: c.

184. The this reference is used in conjunction with ___methods.

Ans: b.

185. Which of the following operators are used in conjunction with the this and super references?

a.The new operator
b.The instanceof operator
c.The dot operator
Ans: c.

186. A constructor is automatically called when an object is instantiated

a. true
b. false
Ans: a.

187. When may a constructor be called without specifying arguments?

a. When the default constructor is not called
b. When the name of the constructor differs from that of the class
c. When there are no constructors for the class
Ans: c.

188. Each class in java can have a finalizer method

a. true
Ans: a.

189. When an object is referenced, does this mean that it has been identified by the finalizer method for garbage collection?

Ans: b.

190. Because finalize () belongs to the java.lang.Object class, it is present in all ___.

Ans: b.

Post a Comment

Mới hơn Cũ hơn