0
I dont know why this output come like dis Abc@2a139a55
16 odpowiedzi
+ 8
Harsh Agrawal
you passed an object and printed the interger value attached to it.
That is the address.
+ 6
Here is an example added to your code
https://code.sololearn.com/cL93N69wsFC7/?ref=app
+ 5
I belive you printed the address of the object.
+ 5
"this" gets the current object memory address
+ 4
Harsh Agrawal press the checkmark on Donna 's answer
+ 4
Harsh Agrawal
when you try to print the reference variables..
so our complier
automatically invoke "reference variables. toString ()"
toString () is method of Object Class..
so in toString()
code is return to
give us the hashcode..
note in java
we cant determined the address of object or not even class.
if we try to print
toString () method invoke and its return us the hashcode..
As you know that
object is a parents of all class
so
in case of String class
object is also a parents of String class
so toString ()method of object class is overriden there and
in that function
the code is written to takeout the value store in the object
i.e
we see the ans
for eg
String s="hello";
s is also a reference variables of String class type
so
when you try to print s
the toString method of String class invoke
the overriden of toString ()
is invoke..
that why we see ans hello
not hash code....
one last question
do you know how to do javadoc
if know tell me
and
if you dont asked..
+ 4
Harsh Agrawal
if you know how to do javadoc.
you see all the classes and function of java.
what function do
what is return type and
so many things
+ 4
Harsh Agrawal
are you at discord
if you not join it okkk
Kirito#2314
+ 2
thnxxxx both of u!!!!
as this is a keyword which is used to reference d variable
+ 2
Arun Tomar no bro i dont know javadoc but why did u asked????
+ 1
Manual bro this is not my code as i just checking other code den i see dis code n i get stuck on seeing d output
So is it dis output address???
+ 1
Manual In ur program why u use this?????
0
can u give me link so i can join it!!!Arun Tomar