Rajitha Murthy

Greenhorn
+ Follow
since Mar 31, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Rajitha Murthy

Thank you ver much.I under stood very well
hai,
The output of the following code is 'A'.But if
we'll change m1's signature in all the classes to no argument method then output will be 'C'.why?


class A

{

void m1(A a)

{

System.out.print("A");

}

}

class B extends A

{

void m1(B b)

{

System.out.print("B");

}

}

class C extends B

{

void m1(C c)

{

System.out.print("C");

}

}

class D

{

public static void main(String[] args)

{

A c1 = new C();

C c3=new C();

c1.m1(c3);

}

}
hi,
the following program is generating classcastexcception.I need the reason for that and also i need how to catch that exception

import java.util.*;
public class Test1{
public static void main(String a[]) {
Set s = new TreeSet();
s.add(new Person(20));
s.add(new Person(10));
System.out.println(s);
}
}
class Person{
Person(int i){}
}
What are the best books for preparing scjp 1.4?