File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

int/floats in constructor

 
Nick George
Ranch Hand
Posts: 815
  • 0
  • 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
  • 0
  • 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
Marshal
Posts: 33671
316
Eclipse IDE Java VI Editor
  • 0
  • 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
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • 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
  • 0
  • 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