aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes error in result 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 "error in result" Watch "error in result" New topic
Author

error in result

Marcelo Ortega
Ranch Hand

Joined: May 31, 2005
Posts: 519


What is the result?
A. x = 0
B. x = 42
C. Compilation fails because of an error in line 2 of class Test2.
D. Compilation fails because of an error in line 3 of class Test1.
E. Compilation fails because of an error in line 4 of class Test2.

Answer given is C, but i think it should be B???


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJD, SCEA/OCMJEA

Live life to an interface, not an implementation!
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Answer given is C, but i think it should be B???
I'm thinking it should be E, as the variable 'x' only has package access...
Marcelo Ortega
Ranch Hand

Joined: May 31, 2005
Posts: 519

Your right Steve, thanks.
Sakti Singh
Greenhorn

Joined: Dec 13, 2000
Posts: 16
I agree with Steve, given the files are in proper package the answer should be E. If you make x public, output will be x = 42.
sameer inamdar
Ranch Hand

Joined: Jul 04, 2005
Posts: 40
yes compilation fails as the compiler doesnt recognize X at line 4.


Dream!!! Set Vision !! Transform Vision to Mission by Actions on Deadlines!.
sameer inamdar
Ranch Hand

Joined: Jul 04, 2005
Posts: 40
How to make X visible
sameer inamdar
Ranch Hand

Joined: Jul 04, 2005
Posts: 40
making X public still it give compilation error.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error in result