Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can i use "this" name for any method as an identifier in java.

 
Omkar G. Deshmukh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can i use "this" name for any method as an identifier in java.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65113
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only in non-static methods to refer to the object instance. There is no object instance in the case of static methods, so no this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic