I think it would be platform dependent. Some will offer time slicing and others will offer thread priorities. I guess calling sleep() would be a way too.
I used this formula #/2^n where # is the number and n is the shift number, so we get 128/2^2 = 128/4 = 32. Since the # is not a negative number, the sign will not change, giving you a positive result.
Hi Vats, I only took Java in college and it's been a few years since then. I plan to take the SCJP very soon. I would think that taking a programming class would make things much easier while on the job, but maybe not necessarily for passing the exam.
Also, for the 1st one, (-1>>>2) I know that the answer will be a positive number since the >>> produces a sign change if the number, in this case (-1), is a negative number.
To add to my question(sorry, missed this), I would like to know where the f.myBar.barNum was changed to formerly produce the output of 28 and now to 99. I'm thinking it's occurring where the * are. Am I correct?
This is coming from the 1.4 Bates book (pg. 187-188)...Can you explain where the reference is being changed? My guess is where the * are..help please!
class Bar {int barNum =28;} class Foo{ Bar myBar = new Bar(); void changeIt(Bar myBar) { myBar.barNum = 99; System.out.println("myBar.barNum in changeIt is " + barNum); * myBar = new Bar(); myBar.barNum = 420; System.out.println("myBar.barNum in changeIt is now " +barNum); } public static void main(String args[]) { Foo f = new Foo(); System.out.println("f.myBar.barNum is " + f.myBar.barNum); * changeIt(f.myBar); System.out.println("myBar.barNum after changeIt is " + f.myBar.barNum); }
Code prints:
f.myBar.barNum is 28 myBar.barNum in changeIt is 99 myBar.barNum in changeIt is now 420 f.myBar.barNum after changeIt is 99
Hi, Does anyone know when will be the last day for this exam to be given? (1.4) I see that the book for the 1.5 exam is not available until May 2007 through amazon.com...