Timmy Marks

Ranch Hand
+ Follow
since Dec 01, 2003
Merit badge: grant badges
For More
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 Timmy Marks

I thought that had already been done. Can't Jess solve a puzzle like this?
18 years ago
Well, since noone else seems to want to answer, here is what I got

[ August 17, 2005: Message edited by: Timmy Marks ]
18 years ago

The difference between a synced block and a synced method is simply one of notational convenience.

I think this is not quite true. Although it can be used like this in the way you describe, a synchronized block is infinitely more useable than a synchronized method. A synchronized method can only synchronize on the object (or class) which holds the method, whereas a synchronized block can synchronize on any Object.

Consider translating this into a synchronized method:

It can't be done. This is the true difference between synchronized blocks and synchronized methods. So, while true that the synchronized method can be a shorthand form of a synchronized block, this is only true in a limited number of cases.

if(asciiVal between 65 to 90)

Of course, this fails when using non-ascii character sets. There is a way that uses the same concept. Given that most character sets have the upper case letters consecutively, you can just ask

18 years ago
I think the easiest solution would be to register a domain. :-) Otherwise, if you want to serve from your home machine, the cheapest solution would be register with a dynamic dns service and then just use

to get an InetAddress for use when creating your Socket, i.e.

btw, dyndns.org is a site offering the dynamic dns service for free
18 years ago
I'm saying that some optimizing compilers are definitely smart enough to notice when for instance an if construct will always be evaluated as true (or false) and therefore remove the test (or, in the case of always false, it could discard the entire block), after all, why test for a condition that will always be true?

Notice, this is not restricted to if constructs, any type of control structure can be optimized if the compiler sees that it can evaluate it at compile time.
The volatile keyword is not used very much in Java, it is much more common in C. The optimizations are something like this: What if we have a field x that can be changed from within some other process and we write the code

An optimizing compiler could say "well, in the line above the if, x is assigned the value 5, so of course it is greater than 3. We don't need the if because it will always evaluate to true" and promptly changes your code to

By declaring x as volatile, however, you tell the compiler that x can be changed between the line "x = 5;" and the if construct, so it will not assume that the value will still be 5.
Well there you have it, it appears the answer should be D. The nature of the explanation shows that C is not right.

I'm going to say mine is probably a first edition (I think other editions would say it on there), it is terribly old, but it got me through certification with no other preparation (albeit, that was quite a while back).
In the copy of the book I have, the same question is posed, but with only answers

A. When the application is run, thread hp1 will execute; threads hp2 and hp3 will never get the CPU.
B. When the application is run, all three threads (hp1, hp2, and hp3) will get to execute, taking time-sliced turns in the CPU.
C. Either A or B will be true, depending on the underlying platform.

The answer given is C for the usual reason (platform independence). I don't know what edition this is, as it doesn't say on the cover or in the front matter, but it is The Complete Java 2 Certification Study Guide (Roberts, Heller, Ernest) from Sybex 1999.

Maybe Mr. Heller can give us an insight?

wouldn't polymorphism come into play? so the word Hello cannot be printed out correct?

Don't forget, t1 is not a TestClass, it is an A. That's why it is not a question of polymorphism.
How are you getting your binaries? If you have strings, you can compare length (after trimming leading '0's). The longer is larger. If they are the same length, compare from left to right. The first time one is '1' and the other is '0', the one with the '1' is larger. They are equal if you get to the last bit and they are also the same.

As to your second question, you simply need to add '0's to the left side of your representation, and drop the right bits. Once again, it will depend on how you are representing the bits.
18 years ago

So is it always true that if all the points along the border of a bounding rectangle converge then all the points on the interior also converge? Has this been proved mathematically?

Well, according to this page, the Mandelbrot Set is simply connected. I don't have the math to understand the argument for it, but it should be enough to answer your first question in the affirmative.
18 years ago
The setColumns method will be able to adjust the width, and you can also override getPreferredSize to give it the width and height you require.

The default implementation of getPreferredSize returns:

If a non-zero number of columns has been set, the width is set to the columns multiplied by the column width.

18 years ago
Actually, the author did give away much too much. He didn't obfuscate his source.
18 years ago