/* Please try the BeginnerExamples before the IntermediateExamples
To compile:
\methcall> javac java_toggle\*.java
Let's put the files in a jar file so we can show how to reference
Java jar files from nicec and Nice archives.
\methcall> jar cvf toggle.jar java_toggle
added manifest
adding: java_toggle/(in = 0) (out= 0)(stored 0%)
adding: java_toggle/Toggle.class(in = 410) (out= 287)(deflated 30%)
adding: java_toggle/Toggle.java(in = 330) (out= 145)(deflated 56%)
*/
package java_toggle;
public class Toggle {
public boolean state = true;
public Toggle(boolean start_state) {
this.state = start_state;
}
public boolean value() {
return(this.state);
}
public Toggle activate() {
this.state = !this.state;
return(this);
}
}
-- IsaacGouy - 30 Aug 2003
| Topic JavaToggleExample . { Edit | Attach | Ref-By | Printable | Diffs | r1.2 | > | r1.1 | More } |
|
Revision r1.2 - 17 Sep 2003 - 18:00 GMT - IsaacGouy Parents: WebHome > CodeExamples |
Copyright © 1999-2003 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems regarding TWiki? Send feedback. |