File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes int/floats in constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "int/floats in constructor" Watch "int/floats in constructor" New topic
Author

int/floats in constructor

Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
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 ]

I've heard it takes forever to grow a woman from the ground
Adam Richards
Ranch Hand

Joined: Nov 03, 2005
Posts: 135
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

Joined: May 26, 2003
Posts: 30586
    
154

Since this isn't tied to Eclipse, I'm moving it to Java In General (intermediate).


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Lets see the Box(float, float, float) constructor.


[Jess in Action][AskingGoodQuestions]
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
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.
 
GeeCON Prague 2014
 
subject: int/floats in constructor