Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use ??

 
Manal Ahmad
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello there how are you ???
i want to aske about how to use overriding object. toString



i hope someone help me


thanks alot

and also i want to aske about how can i change my nick to my real name i tryed manu time but i coudnt found ??

thanks alot
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When you override a method in a superclass you simply define the
same method in your class.

Note, that all classes are subclasses of Object.

Example: I wan't my class Soccer to print the players name when toString
is called:


/Svend Rost
 
Manal Ahmad
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there

why we use this .name ??
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i hope B Eckel is gonna forgive me for this copy paste.
from Thinking in Java:
Normally, when you say this, it is in the sense of �this object� or �the current object,� and by itself it produces the reference to the current object. In a constructor, the this keyword takes on a different meaning when you give it an argument list. It makes an explicit call to the constructor that matches that argument list
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic