Results 1 to 2 of 2
- 04-12-2012, 05:28 PM #1
Senior Member
- Join Date
- Jan 2012
- Posts
- 146
- Rep Power
- 0
What is the significance of THIS?
I need to know the significance of the keyword this. It seems to me like it does nothing, since I get no errors when I run it without this.
Java Code:package OOP; class rect{ int width; int height; int depth; void box(int h, int w, int d){ this.width = w; this.height = h; this.depth = d; } void result(){ System.out.println(height); System.out.println(width); System.out.println(depth); System.out.println(depth * width * height); } } public class Rectangle { public static void main(String [] args){ rect objRect = new rect(); objRect.box(24, 10, 5); objRect.result(); } }
- 04-12-2012, 05:34 PM #2
Re: What is the significance of THIS?
First result for googling "java this keyword": Using the this Keyword (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Similar Threads
-
Significance of the main method in a java program
By Dreaming in forum New To JavaReplies: 10Last Post: 01-29-2012, 03:21 AM -
significance of static variables and methods
By imran_khan in forum New To JavaReplies: 4Last Post: 08-02-2007, 09:52 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks