Saad Ahmed

Greenhorn
+ Follow
since Aug 03, 2001
Merit badge: grant badges
For More
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 Saad Ahmed

Not exactly what I meant, let's say:
public interface A {
String getMesg();
}
public interface B {
String getMesg();
}
public interface AB extends A, B {
}
public class implements AB {
String getMesg(} { return "hello"; }
}
This is valid...so Java does support multiple inheritance by interface...I want to know what are the major benefits of class-based inheritance?
22 years ago
Hi, you always see people say Java doesn't support multiple inheritance but can someone explain what is the difference if a class implements an interface that extends from multiple interfaces? Isn't that the same thing?
22 years ago
Hi, a synchronized method locks on the object of the class, in case of a static synchronized method, it is the class itself (very important).
Hi, i'm basically trying to implement a timeout for a URL connection in an applet (can't use sockets). There is basically a time consuming function in the thread run method that opens the url stream and does a few things. The problem is if I invoke another thread to sleep for TIMEOUT in ms and then when it wakes up do an interrupt(), it really doesn't work because the interrupt can occur before the time consuming function or after...and so the thread will continue, I want the function that is time consuming/blocking to be terminated if the other thread issues an interrupt().
The problem rises from the fact that the thread run function executes some methods in a serial fashion, ie. it having no loop, while, etc...just a few statements it needs to execute, so there is no condition to check. Some people noted that in this case it would be safe to call Thread.stop() but I was wondering if there was a better solution, I thought of placing a loop before the timeconsuming function like:
while(!isInterrupted())
timeconsumefunc.retrieve()
but this only applies to one part of the thread so seems sort of wrong. Any suggestions?