Static methods - Math ,System

Q.  Which Java.Lang contains only static methods?
- Published on 19 Oct 15

a. Math ,System
b. Number,Exception
c. There is no such class
d. none

ANSWER: Math ,System
 
System and Math are only two classes that do not have any method that does operation on the object of any class where they are used. Hence it has all methods as static. System class contains utility methods for handling operating system specific task and they do not operate on object instance. For example the getproperties() method of the System class gets the information about computer. The math class uses the utility methods for math operations. Such as exponential,logarithmic,random etc. All other classes have method/methods which operate on object of the class.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)