Simple question in some methods in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Simple question in some methods in java

What is the different between this two ways String x ='a'+""; String x=String. valueOf('a');

12th Dec 2018, 5:01 PM
ABADA S
ABADA S - avatar
2 Answers
+ 1
It will produce the same result. But in theory, The first method is called Implicit Casting, while the second mehod is called Explicit Casting.
13th Dec 2018, 10:04 AM
Owenizedd
Owenizedd - avatar
+ 3
Thank you very much
15th Dec 2018, 6:41 PM
ABADA S
ABADA S - avatar