String text = ""; // in java what will be the value of text? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

String text = ""; // in java what will be the value of text?

31st Oct 2018, 10:00 PM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar
6 Answers
+ 3
Yes... If you assign null to an object reference, then you indicate that the reference dont point to an object... In your case a String, though empty, its always an valid and existent object
31st Oct 2018, 10:09 PM
KrOW
KrOW - avatar
+ 2
An empty string
31st Oct 2018, 10:04 PM
KrOW
KrOW - avatar
+ 2
Mind To Machine 🤖😎 Its true based on my experience 😉
31st Oct 2018, 10:14 PM
KrOW
KrOW - avatar
+ 1
KrOW sounds true based on what i learned so far thx bro
31st Oct 2018, 10:13 PM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar
0
yow KrOW is that different than a null assignment?
31st Oct 2018, 10:05 PM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar
0
Why not just use the Playground and run it yourself? But, to guess, as a non-Java programmer, text will equal a single byte whose value is 0 (NULL). Rationale: It's initialised and in _modern_ C compilers, the zero-byte is appended during initialisation (if not explicitly there and if there is space/array size is unspecified, x[], etcetera).
31st Oct 2018, 10:09 PM
non