Rashmi Liyan

Greenhorn
+ Follow
since Aug 16, 2009
Merit badge: grant badges
For More
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 Rashmi Liyan

Lukas Smith wrote:It is OK to write return in try{}catch{}finally{} block. We can write return; (when a function is declared as void) or return typeValue; (when a function is declared as not void).



Hi Lukas,
can you exlain this little bit. I didn't get it.

Rashmi.
Hi Ankit,
thanks . I got it.

/Rashmi
Hi,
Can someone explain the out put given by the

System.out.println(Suits.values());

it gives '...Bridge$Suits;@1372a1a' as output.

What's this ?

/Rashmi.
Hi Sebastian.
Does it means that Draw method in super class 'Shape' can see the
Draw method implementation in Roundshape class (Since Roundshape is also loaded ) when the Shape constructor runs?.
Which means when a Super class constructor runs , sub class's constructor is also loaded and super class constructor has access to sub class's members. Is it correct , if I say like that.

/Rashmi
Hi Sebastian,
thanks for your explanation.
Yes I understand that radius gets zero since subclass is not intialised when super constructor runs.
question here is when Shape super constructor runs does it see the 'draw' method implementation which is in class RoundShape. How could you explain that?

/Rashmi
Hi Guys,
I have a question about the output of below code.


Output comes as

Shape() before draw()
RoundShape.draw(), radius = 0
Shape() after draw()
RoundShape.RoundShape(), radius = 5

How do you get the output line 2 (RoundShape.draw(), radius = 0).
First code runs super constructor which is 'Shape'. Inside it draw method ( #1)
is called, but it is abstract when Shape is created. This is confusing.
Can someon explain this ?

/Rashmi
Hi Guys,
Thanks for these explanations.
It is clear now.

/Rashmi
Hi,
Thanks for your replies. Still there is somethig which I dont understand.
I understand that Cat class has override toString method.
When Cat class is created it calls Super constructor , which is Animal.
To my understanding Animal Constructor is only

Am I wrong? All it does it assigning the type.

So how does the 'toString' method gets activated?
Please explain

/Rashmi.
Hi Guys ,
I have a problem with following code and output.


When you run above you get the output as follows

Your choice: This is a A
Woof Woof

Your choice: This is a Cat
It's C the D
Miiaooww

Problem here is how do we get he 'It's C the D' line in the output. It seems it is coming from Constructors.
But in Cat class 'toString' method is not inside the constructor.
can some one explian this?

/Rashmi