Win a copy of Terraform in Action this week in the Cloud forum!

Sujith Mahesh

Greenhorn
+ Follow
since Jul 11, 2007
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 Sujith Mahesh

Thanks Rob,

I will declare like this


and While accessing the object I will cast it.
13 years ago
Hi,

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?
13 years ago
Hello Stan,

When we are reading from a common inputStream how to differentiate between "String" and "raw bytes".
14 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.
14 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.