• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

EquationLineaire.java:13: <identifier> expected

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 26770
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see what is wrong with my encoding This is the code:
 
Ranch Hand
Posts: 287
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Marshal
Posts: 73979
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And avoid == true or == false like the plague.

Welcome to the Ranch
 
Campbell Ritchie
Marshal
Posts: 73979
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also avoid if (...) return true; else return false;
 
Sebastien Zerbato
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you guys Harsha what do you mean by primitives ? And I have read the method declaration chapters.
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok thanks to you all
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Look ma! I'm selling my stuff!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic