Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange Vector3(double, double, double) symbol not found?

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




javac QuaternionConverter.java

where I have set the CLASSPATH to ./

Why are there such errors?
Thanks
Jack
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Notice that it says it can't find the method. It's not complaining about not finding a class or not finding a constructor.

That means you're trying to invoke a method like:


Seems you're confusing methods and constructors. Go back and review the relevant sections of your text or tutorial, and post again if it doesn't become clear.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15437
41
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you mean to write: return new Vector3(...) (you forgot the "new" keyword)?

Note: Why are you using float literals, such as 0.0f, instead of double literals, without the f? Your member variables are doubles anyway.

You have unnecessary casts also, to cast your float literals to double. Just write it like this: return new Vector3(1.0, 0.0, 0.0);
No need to use float literals or cast.
 
Sergii Trotsenko
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I can see is that you are defining parameter called _x in constructor and then doing x = x. You forgot about "_" . Seems this is the problem
 
Winston Gutkowski
Bartender
Pie
Posts: 10498
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sergii Trotsenko wrote:What I can see is that you are defining parameter called _x in constructor...

@Jack: And just on that point; I believe that's a C++ or Python convention (maybe others too), but it's generally frowned on in Java. Fields of any kind should start with a lower-case letter; and even though the language does allow you to do otherwise, you'll get funny looks from old farts like me if you do.

Winston
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sergii Trotsenko wrote:What I can see is that you are defining parameter called _x in constructor and then doing x = x. You forgot about "_" . Seems this is the problem

Um, where? I don't see any x = x. I see x = _x, which works fine.
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:@Jack: And just on that point; I believe that's a C++ or Python convention (maybe others too), but it's generally frowned on in Java. Fields of any kind should start with a lower-case letter; and even though the language does allow you to do otherwise, you'll get funny looks from old farts like me if you do.

To be fair, this isn't a field of any kind; it's a parameter.

I have occasionally seen individual shops that use a convention like this, even in Java. Either it's applied to all local variables and params, or it's applied to all fields. Unfortunately I've seen both conventions, which is annoying when the whole point is to distinguish between fields and local vars or params.

Jack: I'm pretty sure your problem has nothing to do with this. Instead focus on what Jeff hinted at, which is what Jesper explicitly pointed out.
 
Sergii Trotsenko
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I see it on the first post listing. Please check screenshot attached. Thanks!
1.png
[Thumbnail for 1.png]
screenshot
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, that's strange. I see it really clearly as

(In case that comes out different for you, all three assignments are of the form var = underscore + var.)

I see that Jack edited this message exactly once, just a few minutes after it was first posted. Jack, is it possible this your edit was changing "x = x" to "x = _x"? That wouldn't explain how Sergii can still see it, but it might be a useful clue if something weird is going on with how posts are being retrieved.

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15437
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That you don't see the underscore in front of the x, that's a bug in the JavaRanch forum software! I see it also (I'm using Chrome).
 
Campbell Ritchie
Sheriff
Pie
Posts: 49761
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can inspect the text of the post and there is definitely an underscore before the x. I could also see, unfortunately, that the indenting uses a combination of tabs and spaces. That is a very effective way to have your code look really peculiar on somebody else’s computer. You should always use spaces.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic