Home arrow static arrow Java Programming [Archive] - Question regarding the MATH Class.Guidance reqd.
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Question regarding the MATH Class.Guidance reqd.
This topic has 1 reply on 1 page.

Posts:754
Registered: 6/13/03
Question regarding the MATH Class.Guidance reqd.  
Jul 13, 2004 3:27 AM



 
HI,

I have a question regarding the Math class.
This class is defined as 'final'.

Now,if a class is declared as final,then all methods
are implicitly final too.Right?

But if you see the Math API,all methods of this class are
declared as static.

Shouldnt the methods be declared as final static rather
than just being declared static?
 

Posts:2,909
Registered: 13.8.2003
Re: Question regarding the MATH Class.Guidance reqd.  
Jul 13, 2004 3:38 AM (reply 1 of 1)



 
I have a question regarding the Math class.
This class is defined as 'final'.

Now,if a class is declared as final,then all methods
are implicitly final too.Right?

Yes, if the laws of logics apply.

But if you see the Math API,all methods of this class
are
declared as static.

gasp

Shouldnt the methods be declared as final static
rather
than just being declared static?

Why? You just said they're implicitly final.
Besides, static methods cannot be overridden so they're implicitly final from that point of view too.
 
This topic has 1 reply on 1 page.