dipayan chatterjee

Ranch Hand
+ Follow
since Oct 03, 2007
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 dipayan chatterjee

Hi dilip

countGold(myGold, 6) basically resolves to this.countGold(myGold,6) and since the main method is static it means it is not running on any instance of class Frodo hence there exsists no object so cant invoke the instance method countGold(intx,inty) .

This is the basic reason why calling a non-static method directly from a static method, this is not allowed.

i think the compiler will throw an error on line number 5 as the value you are trying to assign to a1 exceeds the range of integer

Correct me if i am wrong

Hi Srini

Thanks for replying and posting the link to the article . I am working on a project the involves developing a web service using apache axis . gladly i have been able to develop a small web service client and server(I am new to web services and have no previous experience about the same) I have also been able to send parameters to remote method as SOAP attachments but am unable to extract the SOAP response sent by the server on client side

Can you provide some code illustrating how to extract SOAP attachment using apache AXIS or a link to some sort of online tutorial or resource to do the same

Thanks in advance
11 years ago
Hi Larry

First of all congrats for clearing SCJP

I guess my main question is about anonymous objects and their eligibility for garbage collection. Are these objects not considered eligible for gc if they are in scope i.e. it doesn't matter if there are no explicit references to these objects

IMO garbage collection has nothing to do scope it basically is concerned whether an object on heap is acessible via a reference or not . in the for loop you are creating 10 objects on the heap that basically have no reference to them so even if the main thread is running can you so something like this System.Out.Println(?)

see here in place of ? you need a reference to an object to call its toString() but you dont have one do you?
so you basically cant acess any of the 10 objects so they are eligible for gc

secondly gc is something we cant control we can only request the JVM but JVM is the big boss.If at any point of time the JVM thinks that number of free memory locations are low it will carry out a gc operation it will not wait for your thread to fininsh .

Do correct me if i went wrong somewhere..
Hi Lalit and Ankit

thanks for your explainations now the error makes sense . I tried out the same code on MyEclipse and surprisingly it works just fine . I just modified the code a little

the code compiles and runs giving the output " in default "

could you please throw some light on the reason for such change in behaviour when we run the same code using IDE and command prompt

thanks in advance
Can anyone please post any code on Web service(with SOAP attachment) client which has the attachment type as Octet Stream(MIME Type Mapping as application/octet-stream).
11 years ago
Hi all

Sahil has put a good question the program 2 specified by him certainly looks like a benign java code that should run fine but it is throwing a compile time error

switchlochaTst.java:8: incompatible types
found : char
required: java.lang.Integer
case 's': break;
1 error

I am quite perplexed by this error as according to JLS the wrapper object is unboxed to int and as 's' being a character it is implicitly cast to int so everything should work fine. So ranchers need your help in understanding the reason for the error

Thanks in advance

Hi Ankit

Thanks for the advice so will be targeting SCWCD now.
Hi Christophe,

Thanks for replying i will be using EJB3 in my project along with struts 2.0
Hi All

Well i am not sure whether this is appropriate forum to post my query so my sincere apologies in advance . I cleared my SCJP 1.4 three years back and i have been developing web apps using J2EE(Servlets,Jsp and JavaBeans) for almost a year and half now ,my project is getting over next week and after that i have a month off so was planning to write SCWCD but looking around it seems a lot have changed in Java SE too and my certificate is already 2 versions old and soon to be 3 next year.

So what do you suggest should i go for a SCJP upgrade exam or go forward with SCWCD

Hi All ,

I am a novice to EJB . i have been developing web apps for past one year using servlet , jsp and java beans . I have been recently assigned to a new project that requires knowledge of EJB too. I have a months time to grasp the nuances of this technology, so i need your advice as what my course of action should be . I have been a great fan of the head first series ( have already read HFJava & HFServlet and JSP) so should i go for Head First EJB or are there better books than that???

Waiting for your valuable inputs
Hi Inder
Well i too have very little knowledge as far as jdbc is concerned but i am using 10g too for my backend purpose .Well you can set up a dns for oracle just like you did for access but i would recommend you to go for the Type 4 driver than an ODBC bridge as Type 4 are much faster. take a look here

hope it helps

Hi Mohit

i agree with Ankit , first try out the problem yourself and post what you think the answer would be, we can then identify where you went wrong( if your answer is wrong) in this way you will learn more buddy. so post your answer and we are always there to help you out
Hi Prasad,

In this program you have two threads , main thread and b. After starting b thread , main goes to sleep.
Now b thread get chance to execute . It calls run method and doTask2() method , where it acquires lock of object a
and joins main thread . Due to this, thread b goes in block state with lock of object a .
Now when main thread come out of sleep state . It try to call doTask1() method on object a , but because this method is synchronized , it needs lock of object a , but lock is not available, because it is with thread b.

So both threads now in block state.

Hope it will help you
hi balu
the jar file ojdbc14 exsists i have also checked the classpath but the problelm still persists . i am using myeclipse 6 workbench