Article View: be.comp.programming
Article #7363Re: Java: argumenten meegeven
From: Koen Hautekeete
Date: Sat, 14 Sep 2002 13:13
Date: Sat, 14 Sep 2002 13:13
46 lines
2019 bytes
2019 bytes
On Sat, 14 Sep 2002 14:40:23 +0200, Christof Laeremans
<christof_laeremans@hotmail.com> wrote:
[...]
>En hier volgt de code
>
>import java.lang.String;
>
>class Controle {
> public boolean hasArguments(String[] args) {
>
> if (args.length() == 0) {
^^
length is geen method, maar een variable...
dus args.length gebruiken
> return true;
> }
> else {
> return false;
> }
> }
>}
Even een kleine opmerking: hasArguments geeft als return value true
als er geen argumenten bestaan? Beetje contradictorisch he :)
>
>public class MetOfZonderArgumenten {
> public static void main(String[] args) {
> Controle argumenten = new Controle();
> if(argumenten.hasArguments(args)) {
> System.out.println("GEEN");
> }
> else {
> System.out.println("WEL");
> }
> }
>}
[...]
mvg
Koen Hautekeete
Technical Details
Message-ID:
<2ad6oug7e30p4ttinqthr2op8k8ob2obl8@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!skynet.be!skynet.be!ossa.telenet-ops.be!afrodite.telenet-ops.be.POSTED!not-for-mailReferences:
<B9A8FAD7.AC44%christof_laeremans@hotmail.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcea4,542715d2d7e19b05 X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2002-09-14 06:45:07 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!skynet.be!skynet.be!ossa.telenet-ops.be!afrodite.telenet-ops.be.POSTED!not-for-mail From: Koen Hautekeete <khautekeete_remove@this_hotmail.com> Newsgroups: be.comp.programming Subject: Re: Java: argumenten meegeven Message-ID: <2ad6oug7e30p4ttinqthr2op8k8ob2obl8@4ax.com> References: <B9A8FAD7.AC44%christof_laeremans@hotmail.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 46 Date: Sat, 14 Sep 2002 13:13:50 GMT NNTP-Posting-Host: 213.118.128.74 X-Complaints-To: abuse@telenet.be X-Trace: afrodite.telenet-ops.be 1032009230 213.118.128.74 (Sat, 14 Sep 2002 15:13:50 MET DST) NNTP-Posting-Date: Sat, 14 Sep 2002 15:13:50 MET DST Organization: Telenet Internet