Willie Toma

Ranch Hand
+ Follow
since May 11, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
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.
17 years ago
Then why does:
Runnable rn = aDer;
aDer doesn't implement Runnable, but it executes?
17 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).]
17 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();
17 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).]
17 years ago
Is this correct:
The main method is necessary, but if it isn't there the compiler inserts one.
17 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?
Thanks
17 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.
[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
17 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.
17 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?
Thanks....
If there is no setEnabled method used, is the default set to true?