The Artima Developer Community
Sponsored Link

Java Answers Forum
operator overlaoding in java

1 reply on 1 page. Most recent reply: Jul 7, 2005 2:29 AM by Antonio

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
vaidhyanathan.p.k

Posts: 3
Nickname: vaidya
Registered: Mar, 2005

operator overlaoding in java Posted: Mar 17, 2005 12:54 AM
Reply to this message Reply
Advertisement
how does + operator work for strings?
i just know that stringbuffer append method will be called but i want to know whether + operator is overloade for strings in java


Antonio

Posts: 33
Nickname: arhak
Registered: Jul, 2005

Re: operator overlaoding in java Posted: Jul 7, 2005 2:29 AM
Reply to this message Reply
I don't remember now where is it, but it is possible to see the implementation of that overloading.
Don't make the idea of a toString() method applied to every Object operand because it is also applicable to primitive types an
null
Objects so it isn't the same
System.out.println("testing: "+obj);

than
System.out.println("testing: "+obj.toString());

because in the first case it will print "testing: null" if obj is
null
but in the second case it will throw a NullPointerException

Flat View: This topic has 1 reply on 1 page
Topic: Reflect Error (bug?) Previous Topic   Next Topic Topic: identifying  live processes

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use