aspose file tools*
The moose likes Associate Certification (SCJA,OCAJ 5/6) and the fly likes Clarification for a mock question in net.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Associate Certification (SCJA,OCAJ 5/6)
Bookmark "Clarification for a mock question in net.." Watch "Clarification for a mock question in net.." New topic
Author

Clarification for a mock question in net..

usha sekar
Greenhorn

Joined: Dec 05, 2008
Posts: 8
Hi everybody!!

As i have been preparing for SCJA exam, i am in the process of taking up the mock exams available in the net.

One such question i came across is:

Which of the following statement(s) are not true about JavaBeans?

a) JavaBeans implements java.io.serializable interface.
b) JavaBeans provides no argument constructor.
c) JavaBeans provides getter and setter method for accessing its properties.
d) JavaBeans class can contain public instance variable.
e) None of the above

From my understanding of the concepts, i wld answer "d" as accrdng to JavaBeans specs it cannot contain oublic instance variables.
But in the answers given in the same site, "a,d" is what mentioned.

Is it not one of the specifications for Java Beans that it needs to be Serializable?

Please clarify.

Thanks in advance.
W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
Mind you I'm no expert (as I am currently studying for the SCJA) but I believe that JavaBeans can implement Serializable but don't by default as I believe they can also implement Externalizable.

Again, I'm not an expert, but that is what I'm thinking. If I am wrong someone is welcome to correct me so I know the proper answer too!


SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
usha sekar
Greenhorn

Joined: Dec 05, 2008
Posts: 8
I agree you are right by saying JavaBeans can implement Serializable OR Externalizable.

But still do you think this option(a) can be marked wrong(not true)?

(In this case, guess even the setters and getters need to be coded only by the developer and not given already..)
W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
The way I read the answer is that JavaBeans HAS to implement Serializable, which is false. It has to have either Serializable or Externalizable, but if it has Externalizable then it does not have to have Serializable.

I'm not a big fan of this question, but I've had a lot of coursework in my education that teaches me to look at questions from abstract or unusual angles (being an ethics/philosophy minor does that to you!) which sometimes gets me into trouble when I read too deep into questions that are really just face value.

Anyway, the way the question is worded and how I percieve it, A is false since JavaBeans can implement Externalizable and do not have to implement Serializable.
usha sekar
Greenhorn

Joined: Dec 05, 2008
Posts: 8
This concept of looking at the question from different angles becomes the cause for many such doubtful questions..

Anyways, thanks Joe for your time reg this topic.

And All The Best for your course..



Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14266
    
  21

usha sekar, when you copy a question from a mock exam, book or other source, we require that you quote your sources. So, please tell us exactly where you copied this question from.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
usha sekar
Greenhorn

Joined: Dec 05, 2008
Posts: 8
Oops ..I m sorry for being ignorant of this policy.

This question i had doubt with, is from the SCJAFreeMockExam from ejavaguru.com.

Thanks for your correction Young..

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clarification for a mock question in net..