This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

int/floats in constructor  RSS feed

 
Nick George
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 ]
 
Adam Richards
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.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37234
519
Eclipse IDE Java VI Editor
  • 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).
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets see the Box(float, float, float) constructor.
 
Ken Blair
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!