Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Knute Johnson Newsgroups: comp.lang.java.programmer Subject: Re: Help understanding methods Date: Sun, 27 Jul 2014 18:49:57 -0700 Organization: A noiseless patient Spider Lines: 30 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 28 Jul 2014 01:49:55 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="aba33539224e5c782fe0c4053f7756fd"; logging-data="22281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+T+q5cei9dSigcr+Iulf8C" User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: Cancel-Lock: sha1:qvq8ehzQDaWErNhDGv0cZB1B4AA= Xref: csiph.com comp.lang.java.programmer:29379 On 7/27/2014 18:19, Scott Dunning wrote: > >> The return statement ends the code path so the System.out line can never >> be reached. >> >> The second error is because there is not a return statement as the last >> thing in the method. >> >> To fix it: move the print statement to the main method >> >> That should do it. >> > Awesome, thanks Knute! > > I have a couple other questions about this if you guys don't mind. > > What I'm a little unclear about is when calling the function why I need > maxValue? I kinda just added that because of other methods I've seen. > Why isn't (like python) I'm just calling the method like this... > max3(a, b, c);? > > Why do I need a new (..variable I guess)? You don't. System.out.println(max3(1,2,3)); -- Knute Johnson