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 8770775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:37:30+00:00 2026-06-13T17:37:30+00:00

In an article about how objects are initialized in Java there was a paragraph

  • 0

In an article about how objects are initialized in Java there was a paragraph which is given below:

At the beginning of an object’s life, the Java virtual machine (JVM)
allocates enough memory on the heap to accommodate the object’s
instance variables. When that memory is first allocated, however, the
data it contains is unpredictable. If the memory were used as is, the
behavior of the object would also be unpredictable. To guard against
such a scenario, Java makes certain that memory is initialized, at
least to predictable default values, before it is used by any code.

Can anyone kindly explain that what is meant by unpredictable data and unpredictable behavior here. Thanks in advance

  • 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-13T17:37:31+00:00Added an answer on June 13, 2026 at 5:37 pm

    Can anyone kindly explain that what is meant by unpredictable data and unpredictable behavior here.

    If you programmed in C/C++, you would notice that an uninitialized variable carries some garbage value, present in the memory location allocated to it, interpreted as per the data type of the variable. The compiler doesn’t complain about such variables and if the developer forgets to initialize them properly, the garbage values gets used, resulting in unexpected behavior of the program.

    In Java, the JVM initializes all member variables to the default values based on the data type of the variable and complains about local variables that are not initialized during compilation, to avoid such unexpected behavior and making the developer always use initialized variables.

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

Sidebar

Related Questions

I was reading the paragraph quoted below from an article entitled- Java theory and
I read the msdn article about disposing objects in http://msdn.microsoft.com/en-us/library/ee557362(office.14).aspx now I'm really confused
I've read an article about 20 top jQuery tips that uses the below code
Below is an article about .net framework's use of patterns. I'm not sure I
Possible Duplicate: Questions about Java's String pool Recently I read a java article and
Reading through an Article about custom Objects: http://technet.microsoft.com/en-us/library/ff730946.aspx I wonder why i get a
There is a great article about multiple light sources in GLSL http://en.wikibooks.org/wiki/GLSL_Programming/GLUT/Multiple_Lights But light0
In the wikipedia article about function objects it says such objects have performance advantages
I came across this article about about backbone apps with requirejs. There is one
I was reading this article about Dynamic Objects in C# 4.0 . In that

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.