Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39027

Re: Calling the other overloaded method

From "Jeffrey H. Coffield" <jeffrey@digitalsynergyinc.com>
Newsgroups comp.lang.java.programmer
Subject Re: Calling the other overloaded method
Date 2019-07-30 06:47 -0700
Organization A noiseless patient Spider
Message-ID <qhphqg$9m0$1@dont-email.me> (permalink)
References <878ssfoeav.fsf@munus.decebal.nl>

Show all headers | View raw



On 07/30/2019 06:14 AM, Cecil Westerhof wrote:
> I do not think it is important, but better save as sorry: I am doing
> this in jshell.
>
>
> When I have the following code:
>     Long[] getFibonacciArray() {
>         return null; // getFibonacciArray(0);
>     }
>
>     Long[] getFibonacciArray(int from) {
>         return getFibonacciStream().skip(from).toArray(Long[]::new);
>     }
>
> It compiles without problem. But I want the first method to be:
>     Long[] getFibonacciArray() {
>         return getFibonacciArray(0);
>     }
>
> But when using this, I get:
>     |  Error:
>     |  method getFibonacciArray in class  cannot be applied to given types;
>     |    required: no arguments
>     |    found: int
>     |    reason: actual and formal argument lists differ in length
>     |      return getFibonacciArray(0);
>     |             ^---------------^
>
> What am I doing wrong?
>

I can't replicate the problem on my system, but your code isn't a 
complete example as it doesn't define getFibonacciStream.

Jeff Coffield
www.digtalsynergyinc.com

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Calling the other overloaded method Cecil Westerhof <Cecil@decebal.nl> - 2019-07-30 15:14 +0200
  Re: Calling the other overloaded method "Jeffrey H. Coffield" <jeffrey@digitalsynergyinc.com> - 2019-07-30 06:47 -0700
  Re: Calling the other overloaded method Lars Enderin <lars.enderin@telia.com> - 2019-07-30 17:32 +0200

csiph-web