This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Reg. final keyword Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Reg. final keyword" Watch "Reg. final keyword" New topic

Reg. final keyword

Angela Narain
Ranch Hand

Joined: Apr 14, 2001
Posts: 327
Consider the below code :

I suppose we can always instantiate a final class.
Declaring the class as final just means that it cannot
be subclassed. Am i right ?

I just tried the same with Math class as below :

which gives compiler error

Math() has private access in java.lang.Math

Is it solely for the reason that we invoke the static methods of Math class using the class name..
Marcelo Sousa

Joined: Sep 21, 2001
Posts: 2
The Math Class is actually final, but remember it�s constructor is private! So, you can�t instantiate this class.

I agree. Here's the link:
subject: Reg. final keyword
Similar Threads
about Math class
Inner Class in the Interface
Extending a class with private constructor
Private Final Method
class Math is concrete class but still it cannot be instantiated.