• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

int/floats in constructor

 
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to assume this is Eclipse, and not the rules of Java, but I could be wrong.



The constructor for BoundingBox takes a "Parcel" ( this ), and three floats.
The constructor for Box takes three floats.
The method setLocation takes three floats.

lines one and three work. Line two consistently tells me that the constructor Box( int , int , int ) does not exist. new Box( 1 , 1 , 1f ) works.

Whats the deal with that?

[edited subject so makes sense in JiG forum. was: "Weird behavior in Eclipse."]
[ November 29, 2005: Message edited by: Jeanne Boyarsky ]
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without knowing what class Box is, I'm going out on a limb, but I notice this:

One of your box constructor takes 3 ints, and the other takes 2 ints & a float, evidently. See the Javadoc API for details if this is a standard Java class.

By the way, this issue has nothing to do with Eclipse.
 
author & internet detective
Posts: 39341
755
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this isn't tied to Eclipse, I'm moving it to Java In General (intermediate).
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets see the Box(float, float, float) constructor.
 
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Nick George:
I have to assume this is Eclipse, and not the rules of Java, but I could be wrong.



The constructor for BoundingBox takes a "Parcel" ( this ), and three floats.
The constructor for Box takes three floats.
The method setLocation takes three floats.

lines one and three work. Line two consistently tells me that the constructor Box( int , int , int ) does not exist. new Box( 1 , 1 , 1f ) works.

Whats the deal with that?

[edited subject so makes sense in JiG forum. was: "Weird behavior in Eclipse."]

[ November 29, 2005: Message edited by: Jeanne Boyarsky ]



Does BoundingBox have a constructor that takes three ints instread of three floats? Is there a setLocation() that takes three ints instead of three floats? Does Box have a constructor that takes three ints instead of three floats? I'd bet the answers are: yes, yes, no.

None of those are floats. Chances are you're calling versions that use an int rather than a float. In Java 1 is an int, 1F is a float. 2 is an int, 2F is a float, etc.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!