🌐
Reddit
reddit.com › r/discordapp › what does “null” mean and why is it here
r/discordapp on Reddit: What does “null” mean and why is it here
March 21, 2023 - Even nothing. For example (I will use JavaScript, but it is the same concept in lots of other languages), ... You will get technically two things. ... If you could bypass that error, you would get null.
🌐
Reddit
reddit.com › r/murderdronesofficial › who here knows what [null] actually means?
r/MurderDronesOfficial on Reddit: Who here knows what [Null] actually means?
December 23, 2025 -

I’m asking because my friend, who’s seen Murder Drones several times, apparently though Null was just some randomly generated word, it isn’t!

Does anybody in this sub actually know what Null means?? I’d assume so, but… y’know…

🌐
Reddit
reddit.com › r/learnprogramming › trying to understand null pointers
r/learnprogramming on Reddit: Trying to understand NULL pointers
December 30, 2021 -

Hello all again,

I have another stupid question here lol, so I'm trying to wrap my head around NULL. Im currently under the impression that NULL is a built in constant that has a value of zero, but what does that actually mean? When would it be appropriate to use null? If someone could explain it in layman's terms that would be super helpful!

🌐
Reddit
reddit.com › r/explainlikeimfive › eli5 what's really the difference between null and undefined in programming?
r/explainlikeimfive on Reddit: ELI5 what's really the difference between null and undefined in programming?
July 7, 2026 -

I'm relatively new in programming and these two data types are somehow interchangeable at least in my current understanding. Whenever I try to access a certain variable (that I haven't explicitly set a value), it returns either null or undefined and I still haven't made an intuition of their clear difference.

Edit: programming language is JavaScript

🌐
Reddit
reddit.com › r/baconreader › what does "null" mean?
r/baconreader on Reddit: What does "null" mean?
April 4, 2016 -

There's this post that has many comments with null as their username . . .

Also, it says it was posted 46 years ago . . .

How and why is this?

Edit: for some strange reason, none of the comments say null anymore, coincidentally, but they did, and now I feel stupid . . .

🌐
Meaningschat
meaningschat.com › null-meaning
Null Meaning: Complete Guide
July 13, 2026 - It often means nothing, no plans, empty feelings, or simply joking about a situation. No. Null is generally neutral and not considered offensive. Only if everyone understands the technical meaning.
🌐
Reddit
reddit.com › r/java › java and nulls
r/java on Reddit: Java and nulls
November 26, 2024 -

It appears the concept of nulls came from Tony Hoare back in 1965 when he was working on Algol W. He called it his "billion dollar mistake". I was wondering if James Gosling has ever expressed any thoughts about wether or not adding nulls to Java was a good or bad thing?

Personally, coming to Java from Scala and Haskell, nulls seem like a very bad idea, to me.

I am considering making an argument to my company's engineering team to switch from using nulls to using `Optional` instead. I am already quite aware of the type system, code quality, and coding speed arguments. But I am very open to hearing any arguments for or against.

Top answer
1 of 9
6
String str = null;

means a String reference, named str, not pointing to anything

String str = "";

means a String reference, named str, pointing to an actual String instance. And for that String instance, it is a zero-length String, but it is still an actual object.


Just a little update with some diagram which hopefully can help you visualize that:

assume I have

String nullStr = null;
String emptyStr = "";
String myStr = "ab";

What it conceptually is something look like:

  // String nullStr = null;

  nullStr ----------> X    pointing to nothing



  // String emptyStr = "";
                      +------------------+
  emptyStr ---------> |       String     |
                      +------------------+
                      | length = 0       |
                      | content = []     |
                      +------------------+


  // String myStr = "ab";
                      +------------------+
  myStr ------------> |       String     |
                      +------------------+
                      | length = 2       |
                      | content = [ab]   |
                      +------------------+

(of course the internal structure of the String object is not the real thing in Java, it is just for giving you an idea)


More edit for the rationale behind NULL:

In fact in some language they do not provide concept of NULL. Anyway, in Java (or similar language), Null means semantically different from "empty" object. Use String as an example, I may have a People class with a String preferedTitle attribute. A Null preferedTitle means there is NO preferred title for that people (so that we need to derive and show the title for it, maybe), while a preferedTitle being an empty string means there IS a preferred title, and that's showing nothing.

Btw, although a bit off topic: concept of Null is seen as problematic for some people (because all those extra handling it need etc). Hence some languages (e.g. Haskell) are using some other ways to handle the situation where we used to use Null.

2 of 9
4

String str is a reference to an object. That is, it's not an actual object, but a variable which can contain the address of an object. When you assign a value to str you are changing the address stored within and changing which object it addresses.

null is reference value which points to no object. It's about as close to nothing as you can get. If you assign null to a String reference (String str = null;), you cannot then invoke any method of String using that reference -- all attempts will result in NullPointerException.

"" is a character String which contains no characters -- zero length. It is still an object, though, and if you assign its address to your String reference variable (String str = "";) you can then take its length, compare it to another String, extract its hashCode, etc.

Find elsewhere
🌐
Reddit
reddit.com › r/programminglanguages › why the hate for null?
r/ProgrammingLanguages on Reddit: Why the hate for null?
September 3, 2018 -

Look, I get it: Null pointer exceptions are annoying but so is having to constantly check every object . against null. Is this the new religion after OOP and FP are being phased out? Null just means that the object is not initialized. It's useful to indicate such a state. If you just force yourself to initialize every object to some empty value then you're going to end up passing around empty strings - but wait, an empty string might intentionally be empty or it might indicate "please fill me".

Because I can already tell you what massive insights will come out soon: That null is actually not a mistake at all, it's useful. And the most ironic part about all this? These same people who hate on null are loving nullable types. Litearlly just types that *can be null but you just have to check every time before you use them*. So there is literally no difference except it forces you on a compiler level to check for null every time you use it. When I realized this I thought I was in dreamland, how can these people worship this meaningless little feature so much, crazy. It's literally the same as having null in the language except with a tiny tiny "advantage" that the compiler forces you to check. Which 99.9% of the time, you dont want to be forced because maybe you know implicitly and you dont care [right now].

Top answer
1 of 11
30
Null pointer exceptions are annoying but so is having to constantly check every object Very few values in your program actually need to be nullable, so you only need to check those places where they are. And you should be checking those places anyway! Edit: Note that you might be missing the important fact that you need some way for the compiler to remember that you've done the check. You can do this by pattern matching or flow-sensitive typing, for example. But yeah, this means you don't have to keep going back to check, which would be super annoying! It's also a shame to see the level of negativity in the other comments. It's really useful to hear perspectives like this, because it helps us see how other people might misunderstand what we are doing, and can help improve our explanations. Let's be a little friendlier please! :)
2 of 11
22
Null makes unsound type systems, and is basically a kludge for languages that cannot into algebraic types. Null just means that the object is not initialized What is “not initialized” semantic-wise? If you just force yourself to initialize every object to some empty value then you're going to end up passing around empty strings Wrong. These same people who hate on null are loving nullable types. Nullable types is a yet another kludge for languages without algebraic data types. But at least it's a sound kludge. Which 99.9% of the time, you dont want to be forced because maybe you know implicitly and you dont care C programmers “know implicitly” all the time, that's why their code is so vulnerable. Maybe it's time to recognise that people always make errors?
Top answer
1 of 12
77
It's an old solution to a problem that happened way before Java. I'm old, but I still use it because it's memory efficient and fast. Situational example.. You have a function that returns an int. If you know its always supposed to be positive, it's pretty common to return -1 to communicate that something went wrong, is absent, isn't finished doing something, etc. It's quick. Only requires a single 32/64 bit piece of memory. Solid choice to use when documented well. Instead of integer, let's say you have a class that hypothetically takes up 200 bytes of memory. I don't want to just stop my program because something isn't in a list, and I can't just return -1. I could create a default class that represents a problem just like "-1" does, but that's going to allocate 200 bytes. Assigning the variable to 'null' doesn't allocate 200 bytes. It just points to a universal 'null' memory address that is well understood by the JVM to mean "nothing." "Nothing" saves space and saves a lot of computation power from .equals(...) and even garbage collection. Is it worth having to rely on performing a null check constantly? Actually, yes. It is usually worth it. If people are used to dealing with null, it's not a problem. Coming from different languages where null is not allowed, you get a lot of NullPointerExceptions. Skill issue, though. Edit: Removed most mentions of exceptions to focus on why a new programmer might see "return null" and to appease the Spring devs who believe checked exceptions are relative to OPs question.
2 of 12
6
In some functions, if you can't find the value you want to return, you might return null instead. For example, imagine you have a method that is meant to search for an object in a collection that fits certain criteria. If your collection does not contain such an object, then your method might handle that by returning null. Generally though, this would not be considered great software design. It is very easy to run into runtime errors this way, for example, if a developer using such a method does not realize that it could return null.
🌐
Reddit
reddit.com › r/learnprogramming › where do null values come from in datasets and how to handle them?
r/learnprogramming on Reddit: Where do NULL values come from in datasets and how to handle them?
June 8, 2024 -

My understanding is that NULL represents true absence of value or a total unknown value. This is not the same as empty which is a known value, or a string of zero length. I've worked with banking data and often see lots of NULL values in various fields but if NULL represents UNKNOWN does that mean something simply went wrong/error in the system or is it a legitimate value? Because otherwise I'd think putting empty there makes more sense.

Not really sure how to treat NULL values in these datasets, should I simply ignore them? What if I'm trying to transform the data (or preform joins) on these rows wouldn't NULL values throw all the calculations off?

How should I think about and handle NULL values as they come into my codebase?

Thanks

Top answer
1 of 3
4
It is fine to have null values in data sets. If something can be NULL you are saying, it’s okay to not have it. You just need to make sure that when operating on something that could be null you are checking before operating on it. If(possiblyNullValue) {console.log(“it’s not null”)}
2 of 3
3
NULL values can mean whatever you want them to mean, and different people have different opinions on how they should be used. Generally, the only way they will enter your database is because you insert them -- either explicitly by using NULL as a value in an INSERT statement, or implicitly, by not specifying a value for a column whose default is NULL. Probably the most common reason to use NULL is to represent an "optional" value. For instance, maybe in a banking application, you have a user table with a "social security number" field. Some of your users might be US residents who have an SSN, and others might be foreigners who don't. This could be considered a "true absence of value" because it's not the case that the person has an SSN which is "empty", they simply don't have one. It doesn't necessarily make sense to allow a "missing" or NULL value for every field, which is why databases allow you to easily declare which fields are nullable or non-nullable in your schema. Can you explain why you think using NULL would "throw all the calculations off"? It's true that NULL has different behavior than an empty string, but that might be exactly what you want. For instance, if you perform a join on the SSN field, you probably wouldn't want every possible pair of users with a missing SSN to be joined with each other. Two empty strings are considered "equal", but two NULL values are not.
🌐
Reddit
reddit.com › r/explainlikeimfive › eli5: how do null characters work in programming
ELI5: How do NULL characters work in programming : r/explainlikeimfive
November 26, 2018 - This means that once you see a ... of course, that the data will fit!) and start work on it. Basically, NULL generally signifies that something is empty, or that nothing has been returned....
🌐
Reddit
reddit.com › r/programminglanguages › nulls really do infect everything, don't they?
r/ProgrammingLanguages on Reddit: Nulls really do infect everything, don't they?
July 25, 2022 -

We all know about Tony Hoare and his admitted "Billion Dollar Mistake":

Tony Hoare introduced Null references in ALGOL W back in 1965 "simply because it was so easy to implement", says Mr. Hoare. He talks about that decision considering it "my billion-dollar mistake".

But i'm not here looking at it not just null pointer exceptions,
but how they really can infect a language,
and make the right thing almost impossible to do things correctly the first time.

Leading to more lost time, and money: contributing to the ongoing Billion Dollar Mistake.

It Started With a Warning

I've been handed some 18 year old Java code. And after not having had used Java in 19 years myself, and bringing it into a modern IDE, i ask the IDE for as many:

  • hints

  • warnings

  • linter checks

as i can find. And i found a simple one:

Comparing Strings using == or !=

Checks for usages of == or != operator for comparing Strings. String comparisons should generally be done using the equals() method.

Where the code was basically:

firstName == ""

and the hint (and auto-fix magic) was suggesting it be:

firstName.equals("")

or alternatively, to avoid accidental assignment):

"".equals(firstName)

In C# that would be a strange request

Now, coming from C# (and other languages) that know how to check string content for equality:

  • when you use the equality operator (==)

  • the compiler will translate that to Object.Equals

And it all works like you, a human, would expect:

string firstName = getFirstName();
  • firstName == "": False

  • "" == firstName: False

  • "".Equals(firstName): False

And a lot of people in C#, and Java, will insist that you must never use:

firstName == ""

and always convert it to:

firstName.Equals("")

or possibly:

firstName.Length == 0

Tony Hoare has entered the chat

Except the problem with blindly converting:

firstName == ""

into

firstName.Equals("")

is that you've just introduced a NullPointerException.

If firstName happens to be null:

  • firstName == "": False

  • "" == firstName: False

  • "".Equals(firstName): False

  • firstName.Length == 0: Object reference not set to an instance of an object.

  • firstName.Equals(""): Object reference not set to an instance of an object.

So, in C# at least, you are better off using the equality operator (==) for comparing Strings:

  • it does what you want

  • it doesn't suffer from possible NullPointerExceptions

And trying to 2nd guess the language just causes grief.

But the null really is a time-bomb in everyone's code. And you can approach it with the best intentions, but still get caught up in these subtleties.

Back in Java

So when i saw a hint in the IDE saying:

  • convert firstName == ""

  • to firstName.equals("")

i was kinda concerned, "What happens if firstName is null? Does the compiler insert special detection of that case?"

No, no it doesn't.

In fact Java it doesn't insert special null-handling code (unlike C#) in the case of:

firstName == ""

This means that in Java its just hard to write safe code that does:

firstName == ""

But because of the null landmine, it's very hard to compare two strings successfully.

(Not even including the fact that Java's equality operator always checks for reference equality - not actual string equality.)

I'm sure Java has a helper function somewhere:

StringHelper.equals(firstName, "")

But this isn't about that.

This isn't C# vs Java

It just really hit me today how hard it is to write correct code when null is allowed to exist in the language. You'll find 5 different variations of string comparison on Stackoverflow. And unless you happen to pick the right one it's going to crash on you.

Leading to more lost time, and money: contributing to the ongoing Billion Dollar Mistake.

Just wanted to say that out loud to someone - my wire really doesn't care :)

Addendum

It's interesting to me that (almost) nobody has caught that all the methods i posted above to compare strings are wrong. I intentionally left out the 1 correct way, to help prove a point.

Spelunking through this old code, i can see the evolution of learning all the gotchas.

  • Some of them are (in hindsight) poor decisions on the language designers. But i'm going to give them a pass, it was the early to mid 1990s. We learned a lot in the subsequent 5 years

  • and some of them are gotchas because null is allowed to exist

Real Example Code 1

if (request.getAttribute("billionDollarMistake") == "") { ... }

It's a gotcha because it's checking reference equality verses two strings being the same. Language design helping to cause bugs.

Real Example Code 2

The developer learned that the equality operator (==) checks for reference equality rather than equality. In the Java language you're supposed to call .equals if you want to check if two things are equal. No problem:

if (request.getAttribute("billionDollarMistake").equals("") { ... }

Except its a gotcha because the value billionDollarMistake might not be in the request. We're expecting it to be there, and barreling ahead with a NullPointerException.

Real Example Code 3

So we do the C-style, hack-our-way-around-poor-language-design, and adopt a code convention that prevents a NPE when comparing to the empty string

if ("".equals(request.getAttribute("billionDollarMistake")) { ... }

Real Example Code 4

But that wasn't the only way i saw it fixed:

if ((request.getAttribute("billionDollarMistake") == null) || (request.getAttribute("billionDollarMistake").equals("")) { ... }

Now we're quite clear about how we expect the world to work:

"" is considered empty
null is considered empty
therefore  null == ""

It's what we expect, because we don't care about null. We don't want null.

Like in Python, passing a special "nothing" value (i.e. "None") to a compare operation returns what you expect:

a null takes on it's "default value" when it's asked to be compared

In other words:

  • Boolean: None == false true

  • Number: None == 0 true

  • String: None == "" true

Your values can be null, but they're still not-null - in the sense that you can get still a value out of them.

Top answer
1 of 21
160
The problem isn't null itself. The concept of null (or nil or whatever) is well understood and reasonable. The problem is the broken type system that states: "The null type is the sub type of every reference type." That allows null to be hiding inside of any variable / field / etc. that isn't explicitly a primitive type, and so the developer (in theory) needs to always check to make sure that each reference is not null. Crazy. But easy to solve.
2 of 21
48
I've been handed some 18 year old Java code. If your code makes sure to intern strings, the == comparisons work fine and are fast, so you should find out if those places in your code expect interned strings. Regarding your rant... there's also a cultural component specific to some languages. It seems to me that many Java programmers religiously make sure that every method will handle nulls instead of allowing the NPE to be thrown where nulls don't make sense. If they all didn't, they wouldn't have to be so afraid that someone will pass null where not expected, because client code wouldn't be so sloppy about passing nulls. I know this is true because NPE are just a minor island of "dynamic typing" behavior, yet you don't see this pervasive fear of passing the wrong "type" arguments in truly dynamic languages. The culture in these languages is not to have every function handle every "type" of argument. Instead, an exception is thrown. Because of this, there is no culture of expecting that passing null/nil everywhere should work, and you don't have to be so afraid of that happening.