Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-26-2007, 12:42 PM
Member
 
Join Date: Jul 2007
Posts: 11
money123 is on a distinguished road
question on ObjectOutputStream
Which one of the following requirements must a class meet in order to be written to a stream using ObjectOutputStream?

Choice 1

The class must implement the Serializable interface.
Choice 2

The class cannot have any fields declared as transient.
Choice 3

The class cannot contain any static fields or methods.
Choice 4

The class must provide a SerialPersistentFields array.
Choice 5

All fields and methods in the class must be declared public.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-26-2007, 12:51 PM
Member
 
Join Date: Jul 2007
Location: England, Bath
Posts: 47
shanePreater is on a distinguished road
Choice 1 is needed to write an object out to an object stream.
__________________
Shane Preater -
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-26-2007, 01:04 PM
Member
 
Join Date: Jul 2007
Posts: 11
money123 is on a distinguished road
thankyou so much...... ....one more question is there..........

synchronized void move() throws java.io.IOException {

Additional code here

}

Referring to the sample code above, how can a method in the same class invoke move()?

Choice 1

By enclosing the call inside a "try" block followed by a "catch (java.io.IOException e)" block.
Choice 2

By enclosing the call inside a "try" block.
Choice 3

By calling wait() to obtain the object's monitor before calling move().
Choice 4

By following the call with a "catch (java.io.IOException e)" block.
Choice 5

By enclosing the call inside a "catch (java.io.IOException e)" block.

I think answer is choice 1....am i correct
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-26-2007, 01:08 PM
Member
 
Join Date: Jul 2007
Location: England, Bath
Posts: 47
shanePreater is on a distinguished road
The method is defining throws IOException so anything calling the method will need to either define the same throws clause or call the method with in a try / catch block where IOException is caught.

Which of the options conforms to one of the above?
__________________
Shane Preater -
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-27-2007, 08:59 AM
Member
 
Join Date: Jul 2007
Posts: 11
money123 is on a distinguished road
yes..i think Option 1 is correct...
thanks for clarification....
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 07-27-2007, 12:31 PM
Member
 
Join Date: Jul 2007
Location: England, Bath
Posts: 47
shanePreater is on a distinguished road
Correct and no worries glad to help.
__________________
Shane Preater -
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question mark colon operator question orchid Advanced Java 8 11-27-2008 08:36 AM
ObjectOutputStream Example Java Tip Java Tips 0 03-20-2008 11:21 AM
Need help on this question Deon New To Java 3 01-27-2008 05:58 PM
JNI question javaplus New To Java 0 12-24-2007 12:18 PM
question about rmi leonard New To Java 1 08-06-2007 06:19 AM


All times are GMT +3. The time now is 11:08 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org