• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

toString()

 
Ranch Hand
Posts: 66
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does toString() belongs to Object or String class..
I read that toString () belongs to object class but in String class also I read about that toString()..
so , I need to clarify with you ppl's
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Karthikeyan Pandian wrote:Does toString() belongs to Object or String class..
I read that toString () belongs to object class but in String class also I read about that toString()..
so , I need to clarify with you ppl's



The JavaDoc is a good place to start ... java.lang.Object and java.lang.String.

Henry
 
Karthikeyan Pandian
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But i cant understand the difference..
i just want to know how the same method under two different class
can be used
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Karthikeyan Pandian wrote:But i cant understand the difference..
i just want to know how the same method under two different class
can be used



Do you know what overriding is? And how it works?


BTW, let's move this topic to the beginners java forum...

Henry
 
Karthikeyan Pandian
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes Mr.henry i know
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henry Wong wrote:

Karthikeyan Pandian wrote:But i cant understand the difference..
i just want to know how the same method under two different class
can be used



Do you know what overriding is? And how it works?



Karthikeyan Pandian wrote:yes Mr.henry i know




Basically, the String class overrides the toString() method, because the toString() method provided by the Object class isn't suitable. As for how it works and used, well, you already know.

Henry
 
Karthikeyan Pandian
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, Thank you
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic