This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A java DEBUG flag


Sorry, I know what's wrong with my example. here is the right one:

class Debugging {
    static int openFilesCount;
    static boolean openFile() {
        return openFilesCount++ < LIMIT;
    }
    static boolean closeFile() {
        return openFilesCount-- > 0;
    }
}
class Main {
    void doSomething() {
        assert(Debugging.openFile());
        // do something
        assert(Debugging.closeFile());
    }
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]