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 |
Is it possible to create object with out its default constructor? if possible how? else not possible? justify
Why does java have two ways to create child threads?
Explain what is Marker interface?
What is the program development process?
Howto get an object that will perform date & time calculations then format it for output in some different locales with different date style.can ne1 tel me the answer of this question.pls
Is void a data type in java?
What is linked hashset and its features?
what is a green thread? : Java thread
Will the jvm load the package twice at runtime?
there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box.
What is the platform?
What is java object name?