Sambit Banerjee

Greenhorn
+ Follow
since Jul 29, 2008
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 Sambit Banerjee

a post increment operator is used here.so the answer is 5.
This is a query related to Vara Raju's example.
for the first example (a==b) will be false just because they will refer to different memory location in the non-pool memory?
Am i correct?
[ September 10, 2008: Message edited by: Sambit Banerjee ]
Bert,as you have asked for my jdk version i thought i have a problem with it.So,i have checked it in my friend's pc and i found no problem with Integer.parseInt(arg).
But i have checked the options also and still find that except option b all the options compile the code.
Here's the exact code.

Animal a=new Dog();
Dog d=(Dog)a;

the above represents a downcasting.And the code you have supplied will give classcastexception.This is clearly explained in page no-113(k&b).
can anyone tell me anything about the confusion.
for the second question if you do it manually then it will be like this:
x=1+1+2-2+2+4
so the answer comes to 8.
i hope you have got it now,if you have any problem then i can give you an explanation.
@ pranav,
actually i was getting the follwing compiler error:
Ping.java.18:cannot find symbol
symbol:method parseInt(String)
location:class java.lang.Integer
return Integer.parseInt(arg);
1 error.
so i thought that double quotes should be used.
jiang,sorry i could not get you.please discuss it in a bit details.

i think line 7 needs some modification,the arg in Integer.parseInt() should be in double quotes.and barring option b all the options seem to be right but in the answer it is given only options a and c are correct.
please check this and reply.
Marc,
i did what you have said.but i am facing the same problem.As i asked previously, is it a problem with my jdk?
navaneetha,
can you tell me ways to resolve it please?is it a problem with my jdk?
this is from chapter-4,page-302,question-4,(k&b book)

At runtime i am getting the exception that-
Exception in thread "main" java.lang.NoSuchMethodError:main
Should'nt it be ArrayIndexOutOfBoundsException as given in the answer.
please help.
Bert,
all i could understand is that previously it was Short story=5; later you changed that to Short story=200; and that I should consider Short story=200;
am i right or its something else?
is whizlab indispensable for scjp5?