Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


can write code for serialization ?



can write code for serialization ?..

Answer / bharat shivram

import java.io.*;
public class SerializationDemo {
public static void main(String args[]) {
// Object serialization
try {
MyClass object1 = new MyClass("Hello", -7, 2.7e10);
System.out.println("object1: " + object1);
FileOutputStream fos = new FileOutputStream("serial");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(object1);
oos.flush();
oos.close();
}
catch(Exception e) {
System.out.println("Exception during serialization: " + e);
System.exit(0);
}

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More Core Java Interview Questions

why operator overloading is removed in java?

1 Answers  


Is null false in java?

0 Answers  


What is starvation?

0 Answers  


What is a parameter in java?

0 Answers  


How to create an instance of a class if the class has private constructor?

3 Answers  


What is meant by JVM? Is JVM platform independent or not?

0 Answers   Wipro,


What is unicode used for?

0 Answers  


What does pointer mean?

0 Answers  


what is the significance of listiterator in java?

0 Answers   IBS,


Can a class have 2 constructors?

0 Answers  


What is the superclass of exception?

3 Answers  


How do you implement polymorphism in our day to day life?

0 Answers   Cap Gemini,


Categories