• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Parameters and Function

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)

 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Try to search how to declare method arguments in Java.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guilherme, welcome to the ranch
You should have a look at this FAQ to help other ranchers more efficiently.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That syntax looks like Eiffel syntax, which I am sure is copied almost unchanged from Pascal syntax.
 
reply
    Bookmark Topic Watch Topic
  • New Topic