Ranch Hand
+ Follow
since Nov 22, 2008
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
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anonymous

If I use return 0; in main function( and define in as int main() ,of course)then where does the control is transferred after execution of that last line in the code??Isn't it absurd to use return 0 in main()..???
13 years ago
thanks, I will try it.
15 years ago
You can create a ScheduleExecutorService with the Executors utility class and then you can add to it scheduled tasks for each expiry date/time.
15 years ago

I am doing a program using Java 6 update 11 on Vista with 3 gigabytes of RAM. I am pleased with everything
so far, especially the speed at which my program's GUI executes when it comes to using transparency on a JWindow.

My program allows the user to create a post-it note which consists of 3 JPanels placed in the NORTH, CENTER and SOUTH
regions of the JWindow. The middle panel is devoted to the text note which is painted. So far so good.
I would like the user to be able to set an expiry date and time when the note will disappear.
I can store the date and time in a JavaBean. But I want to know what is the best way to monitor
the date and time while the program is running via the tray class I have created.
The tray class runs if the user creates any number of notes.

I am not asking how to program it, just what approach should be used.

I am assuming some kind of thread that runs in the background if any given note has an expiry date attached to it.
But how to use the computer's date and time checked against that of the DateBean in realtime.

Thanks and happy new year.
15 years ago

Steve Luke wrote:


When you have the .* in the first group, you are greedily collecting all characters possible, which in turn is not leaving any characters to be matched to the rest of the String. You should use a more reluctant qualifier like *?.

Nope, that is not correct. The greedy DOT-STAR will "give up" as much as possible of what it has "consumed" in favour of a match.
15 years ago
Mine too: 00025197
16 years ago
yummmmm. I love cookies.Let them be there.
16 years ago
Thanks Henry,

Please acknowledge me, If I'm echoing back what you have said? Since the return type is not specific, compiler can't assume that the return type would be only Number and hence errors out. Because return type could be even Object and that can't be referenced using Number.
Hi ,

This question is taken from

My doubt here is, we declared the return type as List<? super Integer> i.e it can accept Integer and any super classes of Integer

but in for(Number n:l) , Number is a super class of Integer, but why do we still get compiler error. Please clarify on this.
Yeah, I understood that. But I was worrying if Mary had forgotten to include m.get(new Dog("Clover")); rather than just new Dog("Clover"); I guess it might be a typo error.
Hi Mary,

I have a question about the output mentioned.

Why does the first println display Dog Key. We are actually displaying a new object of Dog class with name "Clover". Same case with the second println statement. Just in case we have overriden toString() method, displaying the name, we would get "Clover" and "Clover" as the output. How did you get the output as Dog Key and null. Can you cross check that again?
Hi ,

As Ahmed suggested, it should implement Comparable interface for Treeset to work and also I guess, you need to check your equals method, as Set does not allow duplicate values. You should override equals method, and that way you can determine whether the newly being added object is already existing or not. Please some one let me know, if this is not a requirement.
Hi Lalit,

Even I checked the ObjectInputStream API and could not find any related method for reading a String. But can't we use public final Object readObject() method, as String extends Object. I haven't tried this, but just a thought.
Hi Keiki,

Is this kind of rebate Sun is offering. I purchased exam voucher for USD 200. What is this USD 60 now. Did Sun cut down its prices ?

When it comes to take a decision about the object, on which method has to be invoked , during cases like this, its always most specific one, given a priority. In our case B extends A. I.e B is more specific object when compared to A. So object of B is choosen. Its always the most specific one taken.

Also, we shall have a compiler error, if both A and B are peer classes. This is observable.