Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parameters and Function

 
paulo cs
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These parameters are giving error. Why? The parameters: a,b and c.


This is message error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method calc(int) in the type Bascara is not applicable for the arguments (int, int, int)

at Bascara.main(Bascara.java:15)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Try to search how to declare method arguments in Java.
 
Guilherme Borges Lima
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must define the types of all arguments of your methods

a = int
b = ?
c = ?

try this:
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guilherme, welcome to the ranch
You should have a look at this FAQ to help other ranchers more efficiently.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paulo, may I suggest you do some reading first? You said in another thread you recently started Java after using Delphi before that, so you probably understand the basics but not the syntax and Java specifics.

The Java Tutorial and/or books like Head First Java are real great to start with.
 
Campbell Ritchie
Sheriff
Posts: 48394
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We don't usually give out straight answers to things people can look up for themselves, but I believe here it is right to give you the answer. Guilherme Borges Lima has shown you the correct version.

As you obviously already know, one has to give a type for each variable, field, parameter, etc. For parameters, you cannot give one type to two parameters.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paulo's syntax comes from Delphi / Pascal, where you only specify the type when it changes. So the following are all Delphi / Java pairs:
 
Campbell Ritchie
Sheriff
Posts: 48394
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That syntax looks like Eiffel syntax, which I am sure is copied almost unchanged from Pascal syntax.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic