Thread: java.lang.Math
View Single Post
  #3 (permalink)  
Old 01-31-2008, 06:17 PM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
Math constructor
Hello eva

It is not always necessary to make a class abstract to prevent it from being instanced. If you omit the constructor or give the constructor some protected access, you can also prevent it from being instanced. It is also possible for other classes to use a method to create an instance of that class without a constructor. For example:
Code:
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(".*");
(Just played with Regex ) I hope this helped.
__________________
If your ship has not come in yet then build a lighthouse.
Reply With Quote