If you have two classes defined as follows: class ApBase extends Object implements Runnalbe class ApDervied extends ApBase implements Observer Given two variables created as follows: ApBase aBase = new ApBase(); ApDerived aDer = new ApDerived(); Why does this statement compile but not execute? Observer ob2 = (Observer) aBase; [This message has been edited by Willie Toma (edited December 10, 2001).] [This message has been edited by Willie Toma (edited December 10, 2001).]
The following code will declare and initialize a reference to NormalClass. NormalClass.NestedClass myNC = new NormalClass.NestedClass(); Is an object of NormalClass created? Is this correct? NormalClass.NestedClass myNC = new NormalClass().new NestedClass();
Which of the following constructor signatrues must exist in the Demo class for DerivedDemo to compile correctly? A) public Demo( int a, int b ) B) public Demo( int c ) C) public Demo() Answer: B and C Why 'C' please explain.... [This message has been edited by Willie Toma (edited December 06, 2001).]
The java mechanism that adds various items togither to create Strings is able to recognize that a reference variable contains the special value null, instead of an object reference. In that case, the string "null" is added. Does it mean that it will print the word 'null' in a System.out.println( ) statement? I've tried to recreate this.... Any suggestions?
It was an incomplete example that was in a book. To display the example I tried to place it in the following block of code. [CODE] import java.awt.*; import java.awt.event.*; class GridBag extends Frame{ public static void main(String[] args){ new GridBagDemo().show(); } // Example code here } Is this the correct way to go about this. Thanks in advance
"If you don't specify a constraint when you add a component to a container with a BorderLayout, a constraint of CENTER is assumed. If you add more than one component without a constraint, only the last one will be kept and the others will not be shown in any position." If you add a button in the NORTH position, and then add a component without specifying a constraint... Wold the button in the north postion be gone? (the background color would show) and the new button would display in the middle.