Shanu Pandey

Greenhorn
+ Follow
since Mar 17, 2011
Shanu likes ...
Tomcat Server Java
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 Shanu Pandey

Sagar Shroff wrote:The Compiler complains for loss of precision.You have to downcast it.
byte b=(byte)27L;


I know that i have to downcast it.But this is the thing which i want to know that why downcasting is not required in case of byte b=27 ,as required in case of byte b= 27l,if both int and long are greater than byte.(byte=8 bit, int=32 bit, long=64 bit).


When line 6 is commented program prints 27,but when line 5 is commented it gives compile time error.Why?? both int and long are greater than byte.then why it occurs with long but not with int.
Ok,now can you please tell me in which chapter of Head First the Garbage Collection is given and to know about GC which chapter i should read???I m online and waiting for your reply...
12 years ago

This Question is from Kathy Sierra page 274 chapter 3.






When line 14 is reached,
(1)how many objects will be created and
(2)how many objects will be eligible for garbage collection?


Please Reply....with diagram (if possible)
12 years ago

This Question is from Kathy Sierra page 275 chapter 3.






When line 16 is reached,
(1)how many objects will be created and
(2)how many objects will be eligible for garbage collection?


Please Reply....with diagram(if possible)
12 years ago
Thanks Yogesh Gnanapraksam,it was very helpful for me...thanks a lot....


Now i just want to know only one thing that,,will line CardBoard c3=null(generated by CardBoard c3=c1.go(c2)) will create any object in the heap or not? And you also have not given the ans that total how many objects will create in the heap.
So please reply..
12 years ago
This Ques is from Katthy Sierra page 269 chapter 3.
12 years ago
I am unable to understand from previous posts..Can you please explain it for me...please...
whether 3 objects will be created or 4?? explain how???
12 years ago

This Question is from Kathy Sierra page 269 chapter 3.






when //doStuff is reached,how many objects will create and how many objects will be eligible for GC?? Please give proper explation,if possible explain with the diagram...Please...
12 years ago
Can init block be declared between a couple of methods?if yes,then how.Please Give code...
12 years ago
If in a code we have a instance initialization code then that code is executed after the constructor's call to the super() is complete.


The output should be:
START
static - grandparent
static - parent
static - child
constructor - grandparent
instance - grandparent
constructor - parent
instance - parent
constructor - child
instance - child
END

But the actual Output is:

START
static - grandparent
static - parent
static - child
instance - grandparent
constructor - grandparent
instance - parent
constructor - parent
instance - child
constructor - child
END

please make it clear why??
12 years ago
yeah.I know that i can do it by using Animal a= new Animal() & a.meth() .But i want to invoke the Animal class meth() by using Dog reference and upcasting or downcasting.is it possible or not??if yes how??
if i want to call the Animal class met(), what to add in the code given below?I want to do it using only either by Downcasting or Upcasting of reference variable..... please reply....
Thanks for reply...But i neeed more help...can anyone explain briefly..??
12 years ago