Jun. 10th, 2005

juan_gandhi: (Default)
public static void main(String[] args) {
  final static String a = "String 8";
  final static String b = "String " + a.length();

  System.out.println("The equality is " + 
                     a == b);
}                      


What will it print:

a) The equality is true
b) The equality is false
c) true
d) false
e) exception is thrown
f) none of the above
juan_gandhi: (Default)
http://seattlepi.nwsource.com/paynter/227497_paynter08.html

Marine recruiters began a relentless barrage of calls to Axel as soon as the mellow, compliant Sedro-Woolley High School grad had cut his 17th birthday cake. And soon it was nearly impossible to get the seekers of a few good men off the line.

With early and late calls ringing in their ears, Marcia tried using call blocking. And that's when she learned her first hard lesson. You can't block calls from the government, her server said. So, after pleas to "Please stop calling" went unanswered, the family's "do not answer" order ensued.
Read more... )
juan_gandhi: (Default)

class X {
   static int value;

   static synchronized void init() {
      if (!initialized) {
         value += 7;
         initialized = true;
      }
   }
   static {
      init();
   }

   static boolean initialized = false;

   static public synchronized int getValue() {
      init();
      return value;
   }

   public void main(String[] args) {
      System.out.println(getValue());
   }
}

What will it print?

a) 0
b) 7
c) 14
d) undefined value
e) exception is thrown
f) none of the above

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

September 2025

S M T W T F S
 1 2345 6
78910111213
14151617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 8th, 2025 01:18 pm
Powered by Dreamwidth Studios