File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes CertPal exam execution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "CertPal exam execution" Watch "CertPal exam execution" New topic
Author

CertPal exam execution

Fidel Edwards
Ranch Hand

Joined: Mar 19, 2008
Posts: 229
Hello Members,

I was attempting one exam for SCJP 1.5 from Certpal. I attempted one question in which output is 5 while according to me it was a compile time error.

this is the code



I tried to execute this code in but it is giving me compile time error.

Please tell me where am I doing wrong?


Thanks in Advance !


God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
OCPJP6
Rajeev Rnair
Ranch Hand

Joined: Mar 22, 2010
Posts: 308

Code seems to be fine! there should not be any compile error.
When you run, it should print 5. I have added a println(o) also, so it should print 5 String[].

please see here


The result is
[Ljava.lang.String;@19821f
[Ljava.lang.String;@addbf1
[Ljava.lang.String;@42e816
[Ljava.lang.String;@9304b1
[Ljava.lang.String;@190d11
5


SCJP6, SCWCD5, OCP-JBCD5, OCE-JWSD6 OCE-JPAD6 , OCM-JEA5 1,OCM-JEA5 2,3 - Brainbench certifications: J2EE, Java2, Java2-NonGUI, JSP, SQL2000 Admin, SQL2000 Programming , Brainbench certified Java Programmer, Computer Programmer, Web Developer, Database Administrator
Fidel Edwards
Ranch Hand

Joined: Mar 19, 2008
Posts: 229
Rajeev Rnair wrote:Code seems to be fine! there should not be any compile error.

The result is
[Ljava.lang.String;@19821f
[Ljava.lang.String;@addbf1
[Ljava.lang.String;@42e816
[Ljava.lang.String;@9304b1
[Ljava.lang.String;@190d11
5



Thanks Rajeev for instant reply

but I am getting this error



I am running this code with 1.6.0_18.
Harpreet Singh janda
Ranch Hand

Joined: Jan 14, 2010
Posts: 317

Do you have more then one version of java installed on your machine?
Fidel Edwards
Ranch Hand

Joined: Mar 19, 2008
Posts: 229
Harpreet Singh janda wrote:Do you have more then one version of java installed on your machine?


Ok Thanks. I had two versions in classpath removing one does the trick.


Thanks Harpreet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CertPal exam execution
 
Similar Threads
Function Overriding
object array?
Java Problem = List of errors, Clueless. HELP
MultiThreading Output
A Question for the group