Friday 4 November 2011

'this' keyword

'this' keyword holds the reference of object of the current class.
So, 'this' can be used to do all the work that an object can do.
Similarly, this( ) can be used to call the constructor of the current class.
Example:
class ThisDemo {
int i ;
ThisDemo( ) { }
void callingFunction( int i) {
this( );                                    // calls the constructor
this.i = i;                                // the value of argument ' i ' is passed to the variable ' i ' of class
}
}

5 comments:

Amzad Ali said...

I would like to have some simple explanation about Dual Core Processor. What d thing is this?

Anjali Sharma said...

Yea. I would also like to know what is this dual core on my motherboard. Well, I just know that a dual core processor is different from a multi-processor system.

Realm Head said...

Yes, you are right Anjali Sharma. A dual core processor is different from a multi-processor system. Dual Core is explained in simple words at http://qsrealm.blogspot.com/2011/11/dual-core-processor.html

Anjali Sharma said...

@ Realm Head : Tks. I got some idea about it and d diagram made it more clear.

Anjali Sharma said...

the topic seems interesting! I have a question about JAVA. Its about main method in JAVA.
If I do not provide any arguments on the command line, then the String array of Main method will be empty or null?
I am confused with empty and null :(

JAVA Project Specifications Lecture Notes: SE OS JAVA

X