debasish tripathy

+ Follow
since Jun 22, 2000
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 debasish tripathy

Thread myT=new Thread();
If myT.start() is called, the run method(which is a do nothing method) of the Thread class will be executed not the run method of the class where the construction statement appears.
If it were
class MyThread extends Thread{
public void run(){
//does something }

public void someFunction(){
Thread myT=new MyThread();
myT.start();} }

then the run method of the class where the construction statement appears will be executed.Because in the above case the run() method of MyThread overrides the run() method of Thread.
Hope this helps
The value returned from compareTo method will depend upon the Strings compared.For example :
class Test{
public static void main(String args[]){
Different cases for the different value at the command line arguement
case 1 : "abc" , "abcdef"
The returned value will be the difference of the length of abc and that of abcdef. Output 3-6=-3
Because in this case "abc" is a substring of "abcdef"
case 2 : "abcdef " , "ab"
Output 6-2=4
case 3 : "abhdef" , abdef
Here in this case noone is substring of another.Hence the check is done whether the first 2 letters of the both the strings differ and like wise it goes on till the first ocurring dissimilsrity.In the above case the the 3rd letter of both the strings differ.
Output : The place of h - the place of d =4
case 4 : "abcdef","ad"
Output : b-d=-2
I hope u r clear...

If a thread is executing a static synchronized method of a class it has to acquire class level lock of that object.If one thread acquires a class level lock of an object then other threads can not run any synchronized methods of that object so long as the thread acquiring the class level lock releases the lock.
Hello Surya,
It is the case of method overloading not overriding as pointed by you.Even if you change the access modifier of the child class draw method to protected you will not get any compile time error.
Anyway i am not clear yet in my question.Please reply soon
becoming restless to know the catch here.Thanx in advance.
class work23 {
work23(int i)
work23(long l)
public void draw(int j)
System.out.println("draw parent");
public static void main ( String a[])
work23 w = new work23(23);
child ch = new child(10);
class child extends work23 {
child(int k)
System.out.println("child int");
public void draw(double ll)
System.out.println("drawing long child");
Here is the code from one of the questions from this forum.
Above code gives compile time error saying reference to draw is ambiguous.Because it can't differentiate the overloaded draw() method.I can't understand why the compiler faces this problem b'cos compiler looks for more specific method and here in this case the more specific method is draw(int j).
Again when I change the above code by placing the
draw(double ll) in the child class in class work23 then compiler doesn't complain.What is the catch here???
Please clear my doubt.Thanx in advance.
First of all look at the signatures of both the methods.
(Here i am considering the methods of Integer class)
Static String toString(int i)
Static Integer valueOf(String s)
toString returns a String reference and takes primitive value
while valueOf returns a Integer object while taking String as parameter.
I think this helps..
Hi everybody,
A new comer to this forum.Got the following doubt.
Which one statement below is true concerning the following application?
1. class TestThread2 extends Thread {
2. public void run() {
3. System.out.println("Starting");
4. yield();
5. resume();
6. System.out.println("Done");
7. }
9. public static void main(String args[]) {
10. TestThread2 tt = new TestThread2();
11. tt.start();
12. }
13. }
I found this question in a mock test exam.I don't remember the name of this exam.
The answer given is both the "Starting" and "Done" will be printed.
But i think that only "Starting" will be printed because after the thread tt is suspended the resume will have no effect and it will remain in the hanging position until you stop the application by pressing ^C.
Pls clear my doubt.Thanking all of you in advance.