Meaningless Drivel is fun!
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
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
It's not a secret anymore!