File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Point2d.Double and Point2d.float Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Point2d.Double and Point2d.float" Watch "Point2d.Double and Point2d.float" New topic

Point2d.Double and Point2d.float

Manish Khurana

Joined: Jan 26, 2008
Posts: 23
Point2d class is an abstract class and has Point2d.Float and Point2d.Double as inner classes. I saw in one book of Java by Igor Hortan i think where he created instances of inner classes with out creating a outer Object. He had code like new Point2d.Float().
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46353
Point2D.Float, not Point2d.Float. You have to be very careful about capital letters.

If you look through the API documentation for the Point2D class you will find you cannot instantiate Point2D anyway; you have to use one of the other three classes mentioned there. You can therefore write new Point2D.Float(1.0f, 99f);

I shall let you go through the API yourself to see what it says about not instantiating Point2D.
Manish Khurana

Joined: Jan 26, 2008
Posts: 23
YOU WROTE : new Point2D.Float(1.0f, 99f);
i had looked at api before. This means you are calling the constructor on an inner class that extends the enclosing class. As I understand it is not possible to create a object of the inner class without an object of the outer class.
Tim LeMaster
Ranch Hand

Joined: Aug 31, 2006
Posts: 226
Looked up nested classes. There are 2 kinds of nested classes static and non-static (inner). Point2D uses static classes.
I agree. Here's the link:
subject: Point2d.Double and Point2d.float
It's not a secret anymore!