Article View: be.comp.programming
Article #7431Java: argumenten meegeven
From: Christof Laeremans
Date: Sat, 14 Sep 2002 12:40
Date: Sat, 14 Sep 2002 12:40
53 lines
2196 bytes
2196 bytes
Hallo,
Heb hier een java programma dat een controle doet als er argumenten worden
meegeven via de command prompt. Bv. java MetOfZonderArgumenten in.txt
out.txt
Maar, hij geeft volgende foutmelding
Volumes/Extra/Development/JavaDev/MetOfZonderArgumenten.java:6: cannot
resolve symbol
symbol : method length ()
location: class java.lang.String[]
if (args.length() == 0) {
^
1 error
Process javac exited with code 1
En hier volgt de code
import java.lang.String;
class Controle {
public boolean hasArguments(String[] args) {
if (args.length() == 0) {
return true;
}
else {
return false;
}
}
}
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");
}
}
}
Wat loopt hier fout ?
Alvast bedankt voor de tips
Mvg,
Christof
Technical Details
Message-ID:
<B9A8FAD7.AC44%christof_laeremans@hotmail.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.bredband.com!bredband!news01.chello.se!amsnews01.chello.com!newsfeed.wxs.nl!news.wxs.nl!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcea4,542715d2d7e19b05,start X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2002-09-14 06:09:49 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.bredband.com!bredband!news01.chello.se!amsnews01.chello.com!newsfeed.wxs.nl!news.wxs.nl!not-for-mail From: Christof Laeremans <christof_laeremans@hotmail.com> Newsgroups: be.comp.programming Subject: Java: argumenten meegeven Date: Sat, 14 Sep 2002 14:40:23 +0200 Organization: Planet Internet Lines: 54 Message-ID: <B9A8FAD7.AC44%christof_laeremans@hotmail.com> NNTP-Posting-Host: u212-239-170-13.adsl.pi.be Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: reader11.wxs.nl 1032007225 5320 212.239.170.13 (14 Sep 2002 12:40:25 GMT) X-Complaints-To: abuse@planet.nl NNTP-Posting-Date: 14 Sep 2002 12:40:25 GMT User-Agent: Microsoft-Entourage/10.0.0.1309