ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
why to use transient variables when  static variables can be
used for Serialization
 Question Submitted By :: Raghupungavaya
I also faced this Question!!     Rank Answer Posted By  
 
  Re: why to use transient variables when static variables can be used for Serialization
Answer
# 1
only non static and non transient variables can be serialized.

if we want a variable to be instance variable,but the
variable is non serializable variable, then we declare that
variable as transient. here exactly we can make use of
transient.
 
Is This Answer Correct ?    10 Yes 2 No
Lenina
 
  Re: why to use transient variables when static variables can be used for Serialization
Answer
# 2
static variables can also serialized but is a very 
cumbersome process. Transient keyword prefixing any 
variable states that the varible does serialized but its 
state i.e. value of the varible, does not serialize.
 
Is This Answer Correct ?    5 Yes 1 No
Priyanjan
 
 
 
  Re: why to use transient variables when static variables can be used for Serialization
Answer
# 3
Both static & Transient are may not be serialized.

Static means one per class not one per object. Static 
variables are not saved and when an object is deserialized, 
it will have whatever static variable its class currently 
has. Don’t make serializable objects dependent on a 
dynamically-changing static variable. It might not be the 
same when the object comes back.

Transient variables are given a value of NULL for object 
references and defaults (0, false, etc) for primitives.
 
Is This Answer Correct ?    3 Yes 1 No
Ram
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
In C we use only compiler. Why java uses both compiler and interpreter? What is its significance?  5
Linked List reverese program Bally-Technologies1
hi to all. well can you please tell me that why String class is immutable? Thanks in advance. Huawei3
How can you eliminate duplicates?  1
How to call static method? Epoch3
explain the life cycle of thread? CTS5
Which class should you use to obtain design information about an object  2
Which Math method is used to calculate the absolute value of a number? Accenture3
what is the use of abstract class? AMDOC2
What is inheritance?  4
How to initialize an Applet ? TCS6
Explain in detail about encapsulation with an example?  3
What is meant by packages?  2
i need example for java abstraction. where we use abstraction and why we need abstraction. Oracle1
which method is used to know the status of the Thread? Honeywell6
What is hash method?  1
how to handled exceptions & erros in ejb? Satyam1
os is developed in c no java is more secured then c na why dont the os developed is developed using java  1
Can a double value be cast to a byte?  3
How can you reverse a string?  4
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com