Sujith Mahesh

+ Follow
since Jul 11, 2007
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
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sujith Mahesh

Thanks Rob,

I will declare like this

and While accessing the object I will cast it.
15 years ago

I want to declare a HashMap where key is of the type "String" and value is a "HashMap".
Here is what I want to declare,

How do I declare this in Java 5.0?
15 years ago
Hello Stan,

When we are reading from a common inputStream how to differentiate between "String" and "raw bytes".
16 years ago
doStuff() in animal class and doStuff() in Dog class are two different static methods. These two are different methods having same name.
And as they are static methods you need class name to access those methods.

In your code, you are using 'a[x].doStuff();' where 'a' represents Animal array. So always doStuff() of Animal class is called.

Hence its called Redefining and Not Overridding.
Abstract class can have both abstract methods and non abstract methods.
Interface methods are implicitly "public abstract".
Abstract class can have non static variables.
Interface variables are implicitly "public final static".

Depending on the above inforamtion you can choose which suits best for your application and implement it.
16 years ago
Hello Khun Sudha,

For 1 and 2 error is not thrown because of "final". Because you have declared C1 and S1 as final inside the method, complier is sure that you cant change final value. So there is no error.
But if you declare like 'final short s1 = 128;' then complier will throw error because 128 out of range for byte.