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

Does treeset allow null in java?

0 Answers  


How to prevent to create multiple objects of a java class?

3 Answers   ASD Lab, TCS,


How do you sort arrays in java?

0 Answers  


What is definition and declaration?

0 Answers  


What is the difference between the continue and break statement?

2 Answers  


What is the difference between assignment and initialization?

0 Answers  


What are the differences between getting and load method?

0 Answers  


What are the 5 types of research methods?

0 Answers  


What string is utf8?

0 Answers  


What is parsing in grammar?

0 Answers  


What is the default size of set in java?

0 Answers  


What are the differences between checked exception and unchecked exception?

0 Answers  


Categories