How to prevent a field from serialization ?
Answers were Sorted based on User's Feedback
Answer / ranganathkini
To prevent a field from being serialized, we have to mark it
with the "transient" keyword
| Is This Answer Correct ? | 13 Yes | 0 No |
Answer / ravikiran(aptech mumbai)
by declaring the varable transient
| Is This Answer Correct ? | 9 Yes | 0 No |
What are the methods used to implement for the key object in the hash map?
What are the different ways to handle exceptions?
What is integer parseint?
What does the “static” keyword mean?
What are the advantages of unicode?
why to use transient variables when static variables can be used for Serialization
Draw a UML class diagram for the code fragment given below: public class StringApplet extends Applet { private Label sampleString; private Button showTheString; private ButtonHandler bHandler; private FlowLayout layout; public StringApplet() { sampleString = new Label(" "); showTheString = new Button (" Show the String"); bHandler = new ButtonHandler(); layout = new FlowLayout(); showTheString.addActionListener(bHandler); setLayout(layout); add(sampleString); add(showTheString); } class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { samplestring.setText("Good Morning"); } } } Note: The methods need not be indicated on the diagram.
What is nextint java?
What is the difference between length and length () in java?
Why should we use singleton pattern instead of static class?
What is foreach loop in java?
Difference between string, string builder, and string buffer?