Brian Albin

Greenhorn
+ Follow
since Mar 02, 2004
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 Brian Albin

Corey,
I use IE6. I just viewed each day again and the problem is now limited to 20 Apr.

Brian
Corey,
For the past week, the SCJP TipLine does not appear to be sized correctly. I have to scroll to see the right-half of the page and printing spans multiple pages as well. Is my system misbehaving or is it the TipLine itself? Any help would be appeciated.
Brian
This one gets confusing pretty quick so use print statements to track the value of variable i and remember that the call to add( ) in class Base actually calls Derived.add( ).
Base.add( ) is called from within Derived.add( )so the program bounces back and forth between the 2 add methods. The value of i increments as follows:
1, 11, 31, 41, 61
Brian
[ April 08, 2004: Message edited by: Brian Albin ]
Hello to the new bartenders!
Corey, Your answers are always tremendous so please don't leave just yet.
To the new guys, I'm attaching a 50 MB file of Java questions that I came up with this morning that need immediate and detailed replies ... just kidding. Good luck to all.
Brian
One quick question ...

I can understand upcasting the reference to an Animal when storing objects of type Horse, Chicken, Pig in an array.
Animal[ ] = new { ... };
One array can hold various types of animals.

But what advantage is their in saying ...
Animal ah = new Horse( );
It would seem that ...
Horse ah = new Horse( );
is a better description of what is actually taking place in code.
Brian Albin
Corey,
Your answer was great as always. You really need to write a Java book if you haven't already done so.
Brian
It helps greatly. Thanks guys.
Brian
Can someone explain why 0 is printed and not 19. I understand that x=23 hasn't been executed yet, but I would have thought that the member variable was initialized to 19 by this point in the program.
Brian
Sekhar,
I didn't ask the question, but I'll jump in and say thanks for the excellent and practical advice. It was very helpful.
Brian
Ernest,
Below is the entire code. The program outputs that the Teller has "put" the first transaction, but the Account thread justs wait and never sees the flag condition satisfied to "get" the transaction.
Edit To Original Post
---
I found the problem and corrected the code below. It now works fine. Ernest, thanks for your reply. You were correct in your guess about a bare wait( ) and bare notifyAll( ).
Brian

[ March 23, 2004: Message edited by: Brian Albin ]
[ March 23, 2004: Message edited by: Brian Albin ]
I have a decent understanding of using synchronized methods and the wait/notify protocol.
My problem is using the synchronized ( object ) approach. See the code framework below for the example problem I am using to learn this topic. The code is lengthy so hopefully the framework explains my problem. It seemed logical to me to sync on the cubbyhole object to ensure that teller's put things there and accounts get things from there in a coordinated fashion. My code compiles, but complains when run that the current thread is not the owner. If anyone, understands synchronized ( object ) I would appreciate your help.
Thanks, Brian

[ March 23, 2004: Message edited by: Brian Albin ]
[ March 23, 2004: Message edited by: Brian Albin ]
I went to a machine with a compiler and tried the following:

This will not compile. The expression used in an if statement or a while statement cannot be blank.
Brian
14 years ago
So ...

should print "true"
(I don't have a Java SDK on this machine to try it now.)
Brian
14 years ago
I know that for ( ; ; ) produces an infinite loop.
My question is ... why?
The termination section is blank, so it would seem that the loop should immediately fall out rather than loop forever.
Brian
14 years ago
Sorry ...
Won't happen again.
14 years ago