File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CertPal exam execution

 
Fidel Edwards
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !

 
Rajeev Rnair
Ranch Hand
Posts: 308
Java Linux Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Fidel Edwards
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 317
Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have more then one version of java installed on your machine?
 
Fidel Edwards
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic