• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Point2d.Double and Point2d.float

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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().
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looked up nested classes. There are 2 kinds of nested classes static and non-static (inner). Point2D uses static classes.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic