Roopak Neevan's Blog

Archive for the ‘Java Concepts : questions’ Category

Java Concept : Why no multiple inheritance

Posted by: Naveen Kapoor on: January 14, 2009

Please refer the below artical for the beautiful Explaination :
http://venkatsadasivam.wordpress.com/2008/08/02/why-multiple-inheritance-is-not-allowed-in-java/

Java Concepts : Serialization

Posted by: Naveen Kapoor on: December 29, 2008

Java allows us to create reusable objects in memory. All of those objects exist only as long as the Java virtual machine. With object serialization, we can flatten our objects and reuse them in powerful ways.
 Object serialization is the process of saving an object’s state to a sequence of bytes, and also rebuilding those bytes [...]

Java Concept : Interface versus Abstract classes

Posted by: Naveen Kapoor on: December 24, 2008

What is the difference between Interface and Abstract class or when to use Interfaces and when to use Abstract class ?
Different ppl give different reasons for the same and the major discussions on internet will give the basic differences or I can say the java specifications for this above discussions .
After going thru lot of discussions [...]

Comparable Interface : Problem while adding object to TreeSet

Posted by: Naveen Kapoor on: November 21, 2008

public class X{
  public static void main(String [] arg){
     Set s=new TreeSet();
     s.add(new Person(20));
     s.add(new Person(10));
     System.out.println(s);
 }
}
class Person{
    int i;
    Person(int i){
         i = this.i; 
    }
}
Can anyone tell me why this code fragment shows me the “ClassCastException”, Using Java 2 1.5 compiler.
In the above code
Set s=new TreeSet();
Set S which is a TreeSet accepts an object [...]



  • mudassir: thanks ............. .................... did a great job for guiding
  • Anand V: This is an wonderful effort !! It really helps lots of parents to understand the procedures and shed light over the minor passport myths. My hea
  • Deepak Dandriyal: Very Good MAN thanks for sharing,,,,,,,,,,god bless