I have 2 objects inside one object(vector). how can i
serialize one of them. I dont want to serialize the second one
Answers were Sorted based on User's Feedback
Answer / atre sachin
suppose we are storing the two object of class A in Vector v1
class A implements serialiazable{
....
}
A a1=new A() //this will be the persist
transient A a2 =new A() //this will not persist because of the transient keyword.
now if I store the both a1 and a2 object in the vector v1 then we can achieve the goal given.
:-)
Is This Answer Correct ? | 10 Yes | 3 No |
this answer is not correct. bcz java compiler will throw an error-illegal declaration of statement.check it out.
I think we will go for Externalizable interface. But the problem is how write the code inside writeExternal() & readExternal() methods
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / priya
yes we are able to done the above question by using
transient keyword
Is This Answer Correct ? | 0 Yes | 2 No |
Difference between java and javascript
Is it possible to write JAVA program without including any of the packages,such as "import java.io.*"; bcoz I instantly wrote a code without "import..." statement and runned the program on command Line & it worked. the code is: class Person { String name; int age; Person(String s,int a) { name = s; age = a; } accept() { System.out.println(name+"Hi!!!!!"); System.out.println(age); } } class Demo { public static void main(Strings args[])throws IOException { String name = args[0]; int age = Integer.parseInt(args[1]); Person p = new Person(name,age); p.accept(); } }
What is a conditional equation?
Difference between vector and arraylist.
What is temp in java?
What is the difference between a local variable and an instance variable?
What are abstract methods in java?
How will you reverse a singly-link list?
0 Answers Akamai Technologies,
In real time project which driver did u use? What is the main functionality of the Prepared Statement?
What is void data type?
What is the importance of main method in Java?
How do you make an arraylist empty in java?