🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: be.comp.programming
1 messages
1 total messages Started by Christof Laeremans Sat, 14 Sep 2002 12:40
Java: argumenten meegeven
#7431
Author: Christof Laeremans
Date: Sat, 14 Sep 2002 12:40
53 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads