Vidya sumanasekara

+ Follow
since Feb 03, 2011
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 Vidya sumanasekara

anirudh jagithyala wrote:

therefore 3/2d=3/2.0=1.5(double)=1.5

Hope it is clear

Oh....I got it...Thanks. the case is "2d"...

Out put:-
1.0 1.5

Why it gives two different output...
help me....

kurt hanni wrote:You are running Parent class, you dont have a main method in your Parent class

yes .... Thanks..

Then output:-

Staticblock Parent
Staticblock Parent 2
Staticblock Child
Initblock Parent
Constructor Parent
Initblock Child
Initblock Child 2
Constructor Child A
Constructor Child

Can you explain me....

out put:-
Staticblock Parent
Staticblock Parent 2
Exception in thread "main" java.lang.NoSuchMethodError: main

Help me to understand this output....
I am new to struts framework. So What are the best references for studying struts.....

13 years ago
int[] a = null , b [] = null; This is same as 1-D a[] and 2-D b[][] is n't it..

Ok..thank you all of you

Hareendra Reddy wrote:Hello Vidya sumanasekara ,
The problem here is this line

Now b is interpreted by compiler as 2-D array i.e b[][] ,
notice that a array if int type and b array of array of ints ..


Output incompatible types
found : int[]
required: int[][]
b = a;
1 error

Can any one please help me to understand the output....
Thanks...every body ....

i got it...
can any one explain me the output?



This happens because of the overriding...

In the supper class Animal -> void makeNoise()

In the sub class Dog-> void makeNoise()//overriden method & playDead()// this is unique for this class

Then you have assining a dog instance to the Animal reference ( in the loop)

In that case compiler check
Animal animal=new Dog();
first reference type (Animal) where there is playDead() method and runtime check the instance type. ok..
In your case there is no any method playDead() in Animal compiler gives an error..

Hennry Smith wrote:

When we try to compile this code, the compiler says something like this:
cannot find symbol
The compiler is saying, "Hey, class Animal doesn't have a playDead() method".
Let's modify the if code block:
if(animal instanceof Dog) {
Dog d = (Dog) animal; // casting the ref. var.

Please explain i am not able to understand this concept...???