Core Java - Interview Questions and Answers

221. A _______ is used to separate the hierarchy of the class while declaring an
Import statement.

Ans : Package

222. All standard classes of Java are included within a package called _____.

Ans : java.lang

223. All the classes in a package can be simultaneously imported using ____.

Ans : *

224. Can you define a variable inside an Interface. If no, why? If yes, how?

Ans.: YES. final and static

225. How many concrete classes can you have inside an interface?

Ans.: None

226. Can you extend an interface?

Ans.: Yes

227. Is it necessary to implement all the methods of an interface while implementing the interface?

Ans.: No

228. If you do not implement all the methods of an interface while implementing , what specifier should you use for the class ?

Ans.: abstract

229. How do you achieve multiple inheritance in Java?

Ans: Using interfaces.

230. How to declare an interface example?

Ans : access class classname implements interface.


Post a Comment

Mới hơn Cũ hơn