Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Willie Toma

Ranch Hand
+ Follow
since May 11, 2001
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Willie Toma

I understand it now...
Thanks for your help.
20 years ago
Then why does:
Runnable rn = aDer;
aDer doesn't implement Runnable, but it executes?
20 years ago
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).]
20 years ago

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();
20 years ago

Why do I get an error in the previous code when it is placed inside a class? "Invalid method declaration; return type required on line 4"

[This message has been edited by Willie Toma (edited December 10, 2001).]
20 years ago
Is this correct:
The main method is necessary, but if it isn't there the compiler inserts one.
20 years ago

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?
Is a sublcass always in the same package as it's parent?
20 years ago
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.
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
20 years ago
So it should say, ".. in the center position" not "... in any position."
"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.
I've been unable to run this code. I tried to implement this constructor in a class. Does anyone have any suggenstions? What i've tried hasn't worked.
20 years ago
Here is the example that I ran across:

I think it's correct to say, it's in the java.awt.Component class?
If there is no setEnabled method used, is the default set to true?