Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes PHP and the fly likes Self? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "Self?" Watch "Self?" New topic
Author

Self?

Josh Huynh
Greenhorn

Joined: Dec 15, 2013
Posts: 3
I'm trying to figure out the answer this question. I tried googling and looking through my PDF text book none of which is able to tell me the value when "self" is used. I understand the basics, ex is a object of method example and 7 is placed in x making val=7.

Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7484
    
  18

Josh Huynh wrote:I'm trying to figure out the answer this question. I tried googling and looking through my PDF text book none of which is able to tell me the value when "self" is used. I understand the basics, ex is a object of method example and 7 is placed in x making val=7.

This sounds like PHP to me - regular Java does not have a "self" keyword. So I'm moving this post to that forum.

If I'm wrong, let me know, and I'll move it to somewhere more appropriate.

Winston

[Edit] Oops, might have jumped the gun.
@Josh: Let me know if this was intended to be a Java question or whether you are, in fact, writing PHP code. If the first, I'll move it back.

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
Welcome to JavaRanch. Given that the code doesn't compile, the question is moot My guess is that the author of this code meant to use this, not self (which doesn't exist in Java): http://en.wikipedia.org/wiki/This_%28computer_programming%29#Java


Ping & DNS - my free Android networking tools app
Josh Huynh
Greenhorn

Joined: Dec 15, 2013
Posts: 3
Updating this. You guys were right. I basically wrote in the question that there is no self in java and explained the differences between self and this. Teacher gave me full credit for doing the research. Thanks for your help!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Self?
 
Similar Threads
this keyword is giving me fits!
Passing same objects in a class constructor and methods
Method Variable
Sudoku Solving Java Program
Get Original Object