• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Clarification for a mock question in net..

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
usha sekar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..



 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
usha sekar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..

 
reply
    Bookmark Topic Watch Topic
  • New Topic