0
String s=null; s=s+"hello"; system.out.println("s");
what will be the output? Nullpointer or print value ?? Answer plz..
16 Answers
+ 1
The real output is error.
"system" must have a capital 'S'.
Aside from that, the output is s.
I assume based on the past comments you actually editted the question, and didn't have the quotes there before.
Without the quotes, nullhello
would be printed.
The reason for this is because it is written in the Source Code to use the value "null" if the string itself is null.
So, you won't be getting any null exceptions for printing things.
0
nullhello
0
right
0
andar will be nullhello
0
if u give null to string it prints nullhello
0
don't give \0
give us null
then see output it prints nullhello
0
no don't give double quotes just give null alone
0
yes null not in double quotes
0
nullhello, but if you remove the quotes.
System.out.println("s"); // Gives a String: "s"
0
thankuuu
- 1
see the out put
here '\0' means null in python
https://code.sololearn.com/cTxS8NWYHx0p/?ref=app
- 1
hello will be printed
- 1
onlyyyy hello
- 1
null is a special type of non charecter...
that consumes no space
- 1
s=null
means s is a empty string
s="null" means s is a string which prints thw word null
null is a keyword when not in inverted commas
- 1
in java...its null the keyword
in python or in c it is '\0'
'\0' = null