java - Checking Chronometer Time from Another Class Shortcut -
i have chronometer in class apple. want check time chronometer @ in class banana. not want create chronometer in class banana, nor want make apple object in class banana. possible?
thanks!
let me know if can more specific.
is there more 1 apple in (presumably) game?
if there 1 can make chronometer public static member of apple , read within instance of banana. this:
public class banana { public void foo() { system.out.print(apple.chronometer.printvalue()); } }
if there multiple apple instances, need 1) put them sort container; 2) pass in, set, or construct instance of banana reference container; 3) access appropriate apple instance in container, , read chronometer's value, call methods, etc. if chronometer private member of apple, need provide accessor method can accessed code in banana instance.
Comments
Post a Comment