View Single Post
Re: liv(int) in Liv cannot be applied to () - Java
Old
  (#3)
KickBot
Member
 
Status: Offline
Posts: 17
Join Date: Apr 2004
Default Re: liv(int) in Liv cannot be applied to () - Java - 05-06-2004

stefan has the answer.

As a more general remark, you shouldn't give the same name to a method and a member variable. This will only cause you more problems like this one in the future. Java coders prefer stuff like getXXX, setXXX, addXXX etc...

Also Java and C++ look similar in some places but there are differences, like no default parameters.
In C++ you would write:
Code:
void foo( int i = 0 ) { ... }
In Java you can't, that's why the compiler refuse to compile your code, and the Java way is to do:
Code:
void foo() { foo(0); }
void foo( int i ) { ... }
Well. At least for j2 1.4, I've heard 1.5 has syntax changes and new stuff.

Hope this heps.

Last edited by KickBot; 05-06-2004 at 11:50..
  
Reply With Quote