• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

this keyword?

 
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
well the keyword this is used to point at the current object, right?

can anone ber more precise on this???
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what do you mean by more precise?

It's similar to me writing a paper and using the word 'my' before 'arm'. the sentence 'arms are tattooed' has a different meaning than 'my arms are tattooed'. using the word 'my' indicates WHICH arms are being talked about.
 
Vishal Hegde
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it by default?

whenever we write a simple hello world program...
(Sir, Huge fan of you and kathys sierra's(including many more cant memorize all the names) SCJP6 Book)
 
fred rosenberger
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is what by default what?

and what does it have to do with a hello world program?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vishal Hegde wrote:
(Sir, Huge fan of you and kathys sierra's(including many more cant memorize all the names) SCJP6 Book)



Yes, fred, when are you coming out with a new one?
 
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The this keyword is a built-in feature of the Java language. So it is always there to be used, not sure if this is what you mean by default?

Hunter
 
fred rosenberger
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ernest Friedman-Hill wrote:

Vishal Hegde wrote:
(Sir, Huge fan of you and kathys sierra's(including many more cant memorize all the names) SCJP6 Book)



Yes, fred, when are you coming out with a new one?



No...they meant they are a huge fan of me...and also a huge fan of Kathy's book. Perfectly logical.
 
Ranch Hand
Posts: 282
Eclipse IDE PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vishal Hegde wrote:Is it by default?



If I understand you correctly, it is optional in certain situations. For example, if you have a class-level field called "foo", you can access this field in a method with or without using "this", so it's optional.



However, if you also have a variable in your method with the same name, you must use "this" in order to refer to the class-level field.


You see this sort of thing a lot in setter methods, where the method parameter usually has the same name as the field.
 
Vishal Hegde
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:

Ernest Friedman-Hill wrote:

Vishal Hegde wrote:
(Sir, Huge fan of you and kathys sierra's(including many more cant memorize all the names) SCJP6 Book)



Yes, fred, when are you coming out with a new one?



No...they meant they are a huge fan of me...and also a huge fan of Kathy's book. Perfectly logical.



Lucky to be one of the members of this forums

thnks i think i am getting concepts clear of this method
 
Do the next thing next. That’s a pretty good rule. Read the tiny ad, that’s a pretty good rule, too.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic