• Post Reply Bookmark Topic Watch Topic
  • New Topic

EquationLineaire.java:13: <identifier> expected  RSS feed

 
Sebastien Zerbato
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am new to java and I created a program and this comes up when I try and the variables from one function to another:

EquationLineaire.java:13: <identifier> expected
public boolean hasSolution(a,b,c,d) {
^
Thanks in advance.
 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That message says that you can't declare a method at that point in the code. In other words, it's saying something about what you have before and after that line. (Which we can't see...)
 
Sebastien Zerbato
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see what is wrong with my encoding This is the code:
 
Harsha Smith
Ranch Hand
Posts: 287
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method declaration is wrong

You cannot create object of a method

Java is not math. use '==' to check equality of primitives. '=' is an assignment operator. ax should be written as a*x

you cannot invoke methods on primitives.

Please read first few chapters of any good java book and you'll get to know how to fix the problem.

 
Campbell Ritchie
Marshal
Posts: 56562
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And avoid == true or == false like the plague.

Welcome to the Ranch
 
Campbell Ritchie
Marshal
Posts: 56562
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also avoid if (...) return true; else return false;
 
Sebastien Zerbato
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys Harsha what do you mean by primitives ? And I have read the method declaration chapters.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sebastien Zerbato wrote:Thank you guys Harsha what do you mean by primitives ?


Java's type system has two main "families" of types: reference types (for referring to objects) and primitives. The 8 primitive types are: byte, char, short, int, long, float, double, boolean.

And I have read the method declaration chapters.


Hint: you should review the method-calling chapters. :-)
 
Sebastien Zerbato
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thanks to you all
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote:Hint: You should review the method-calling chapters. :-)

Looking at line 13, the method declaration chapter might be a useful read as well.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!