Developing Java Beans { lowThreshold = low; }

Developing Java Beans // the constructor public Watcher() { // register as the event listener try { poller.addPollerListener(this); } catch (TooManyListenersException e) { } } // the event handler simulates work by sleeping for// 2 seconds before returningpublic void pollSent(PollEvent evt) { try { System.out.println(”Received Event Number: ” + evt.getValue()); Thread.sleep(2000); } catch (InterruptedException e) { } } } public class Example3 { // the application entry pointpublic static void main(String[] args) { // create the watcher objectWatcher h = new Watcher(); } } Since Example3 is an application, not an applet, you can run it by issuing the following on the command line: java Example3 When you do so, the following will be printed to your console window: Value: 3 Received Event Number: 3 Value: 6 Received Event Number: 6 Value: 9 Received Event Number: 9 Value: 12 Received Event Number: 12 Value: 15 Received Event Number: 15 Value: 18 Received Event Number: 18 Value: 21 Received Event Number: 21 page 47
Note: If you are looking for cheap and reliable provider to host and run your servlet application check Vision servlet hosting services

Comments are closed.