Home
About Us
Contact Us
Bookmark
Saved Bookmarks
Current Affairs
General Knowledge
Chemical Engineering
UPSEE
BSNL
ISRO
BITSAT
Amazon
ORACLE
Verbal Ability
→
Java Interview Questions
→
General in Java Interview Questions
→
How to not allow serialization of attributes of a...
1.
How to not allow serialization of attributes of a class in Java?
Answer»
In order to achieve this, the
ATTRIBUTE
can be declared along with the
USAGE
of transient keyword as shown below:
public class InterviewBitExample { private transient String someInfo; private String
NAME
; private
INT
id; // : // Getters
SETTERS
// :}
In the above example, all the fields except someInfo can be serialized.
Show Answer
Discussion
No Comment Found
Post Comment
Related InterviewSolutions
How does the size of ArrayList grow dynamically? And also state how it is implemented internally.
How many overloaded add() and addAll() methods are available in the List interface? Describe the need and uses.
Why is the remove method faster in the linked list than in an array?
Why does the java array index start with 0?
Contiguous memory locations are usually used for storing actual values in an array but not in ArrayList. Explain.
Can you call a constructor of a class inside the another constructor?
Will the finally block get executed when the return statement is written at the end of try block and catch block as shown below?
Is it mandatory for a catch block to be followed after a try block?
How do exceptions affect the program if it doesn't handle them?
How does an exception propagate in the code?
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply
Your experience on this site will be improved by allowing cookies. Read
Cookie Policy
Reject
Allow cookies