in Java retagged by
0 votes
0 votes

Is null an object?

  1. Yes
  2. No
  3. Sometimes yes
  4. None of these
in Java retagged by

1 Answer

0 votes
0 votes

No , null is not an object.It is a reference type and its value does not refer to any object and so there is no representation of null in memory

Almost all the programming languages are bonded with null. There is hardly a programmer, who is not troubled by null.
In Java, null is associated java.lang.NullPointerException. As it is a class in java.lang package, it is called when we try to perform some operations with or without null and sometimes we don’t even know where it has happened.


 Null is literal in Java and because keywords are case-sensitive in java, we can’t write NULL or 0 as in C language.

Unlike common misconception, null is not Object or neither a type. It’s just a special value, which can be assigned to any reference type and you can type cast null to any type




Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true