Core Java - Interview Questions and Answers

321. What are the constants defined by both Float and Double classes?

Ans : MAX_RADIX,
MIN_RADIX,
MAX_VALUE,
MIN_VALUE and
TYPE.

322. What is the purpose of the Runtime class?

Ans : The purpose of the Runtime class is to provide access to the Java runtime system.

323. What is the purpose of the System class?

Ans : The purpose of the System class is to provide access to system resources.

324. Which class is extended by all other classes?

Ans : Object class is extended by all other classes.

325. Which class can be used to obtain design information about an object?

Ans : The Class class can be used to obtain information about an object’s design.

326. Which method is used to calculate the absolute value of a number?

Ans : abs( ) method.

327. What are E and PI?

Ans : E is the base of the natural logarithm and PI is the mathematical value pi.

328. Which of the following classes is used to perform basic console I/O?
a) System
b) SecurityManager
c) Math
d) Runtime

Ans : a.

329. Which of the following are true?
a) The Class class is the superclass of the Object class.
b) The Object class is final.
c) The Class class can be used to load other classes.
d) The ClassLoader class can be used to load other classes.

Ans : c and d.

330. Which of the following methods are methods of the Math class?
a) absolute( )
b) log( )
c) cosine( )
d) sine( )

Ans : b.

Post a Comment

Mới hơn Cũ hơn