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

  • Home
  • SEARCH
  • 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 6822317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:38:57+00:00 2026-05-26T21:38:57+00:00

In java, you cannot state an array’s size in its declaration int[5] scores; //bad

  • 0

In java, you cannot state an array’s size in its declaration

int[5] scores;  //bad

I’m told this is because the JVM does not allocate space in memory until an object is initialized.
If you have an instance array variable (auto initialized with a default value of null), does that variable point to a place in the heap indicating null?

  • 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-05-26T21:38:57+00:00Added an answer on May 26, 2026 at 9:38 pm

    No, because in the JVM there’s no need for that.
    If you’re in a native language (C and C++, for instance), NULL is a pointer with a zero value, and that points to the memory base address. Obviously that’s not a valid address, but you “can” dereference it anyway – especially in a system without protected memory, like old MS-DOS or small ones for embedded processors. Not that it would be a valid address – usually that location contains interrupt vectors and you shouldn’t touch them. And of course in any modern OS that will raise a protection fault.

    But in the JVM a reference to an object is more like a handle (i.e. an index in a table) and null is an ‘impossible’ value (an index that is outside the domain of the table), so it can’t be dereferenced and doesn’t occupy space in such table.

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

Sidebar

Related Questions

I cannot download file using java if the url contains special characters. eg:-http://something.com/something/this+this+this.html http://something.com/something/this%20this%20this.html
$ javac TestFilter.java TestFilter.java:19: non-static variable this cannot be referenced from a static context
How can I check the state of the mouse buttons in Java? I cannot
This problem is specifically about Sun Java JVM running on Linux x86-64 . I'm
$ javac GetAllDirs.java GetAllDirs.java:16: cannot find symbol symbol : variable checkFile location: class GetAllDirs
$ javac TestExceptions.java TestExceptions.java:11: cannot find symbol symbol : class test location: class TestExceptions
I cannot understand the Java memory usage. I have an application which is executed
In Java, constructors cannot be recursive. Compile time error: recursive constructor invocation. Let's assume
I'm getting a class cast exception namely java.lang.ClassCastException: android.app.Application cannot be cast to greendroid.app.GDApplication
I'm using plain old java mail (mail-1.4.1.jar - JVM 1.6.0_03-b05) to connect to an

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.