Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8083581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:31:10+00:00 2026-06-05T17:31:10+00:00

In a process of leaning java serialization concept, i was puzzled at one point.

  • 0

In a process of leaning java serialization concept, i was puzzled at one point. In java serialization process, we use 2 keywords to prevent serialization, i.e.., transient and static. If i don’t want to save an instance variable, which keyword should i use, both does exactly the same.

Class A implements Serializable{
  private static int x;
  private transient int y;
  private transient static int x;
}

In the above code all the three instance variables are not saved in a process of serialization. Which keyword is apt and recommended to prevent serialization. Why does two keywords have almost the same functionality. What is the recommended way of declaration to prevent serialization. Correct me if I’m wrong, I’m still learning.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:31:13+00:00Added an answer on June 5, 2026 at 5:31 pm

    The static keyword transforms an instance variable into a static variable. A side-effect is that the field is not serialized anymore… because it’s not a field anymore.

    A static variable is a variable of the class. An instance variable is a variable of the object, or instance of the class. You can’t blindly go from one to the other.

    Read the tutorial page about instance and static variables.

    The transient keyword is the right keyword to use, of course.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What does public static void mean in Java? I'm in the process of learning.
I'm learning how to use maven for my standalone java apps but I don't
I am in the process of choosing a Java SSH libary. I am leaning
On the process of learning Assembly i got one question If i do the
I am in the process of learning how to use SWIG on Windows. The
Background: I'm doing machine learning research, and want to use the FANN library to
I've recently starting learning java web development and I want to learn/understand: What constitutes
I'm stumbled upon understanding java serialization. I have read in many documents and books
I am new to my position, and am in the process of learning Java
I am learning Java and in the process I am writing a Word Guess

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.