1 23 24 package j2me; 25 26 public class ServerImpl implements Service, ServiceAttributes { 27 28 private String header = ""; 29 30 private int count = 0; 31 32 public void print (final String msg) { 33 new Exception () { 34 public String toString () { 35 return "Server: print method called"; 36 } 37 }.printStackTrace(); 38 System.err.println("Server: begin printing..."); 39 for (int i = 0; i < count; ++i) { 40 System.err.println(header + msg); 41 } 42 System.err.println("Server: print done."); 43 } 44 45 public String getHeader () { 46 return header; 47 } 48 49 public void setHeader (final String header) { 50 this.header = header; 51 } 52 53 public int getCount () { 54 return count; 55 } 56 57 public void setCount (final int count) { 58 this.count = count; 59 } 60 } 61 | Popular Tags |