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


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

Calling the other overloaded method

From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.java.programmer
Subject Calling the other overloaded method
Date 2019-07-30 15:14 +0200
Organization Decebal Computing
Message-ID <878ssfoeav.fsf@munus.decebal.nl> (permalink)

Show all headers | View raw


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?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Back to comp.lang.java.programmer | Previous | Next — 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