Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

Re: Implicit and Explicit Parameters,,,What's the differences?

Fri Jun 08, 2007 12:34 am

very cool article

so can we sayed : there is only one implicit parameter(this object) for every class ?



Re: Implicit and Explicit Parameters,,,What's the differences?

Fri Jun 08, 2007 11:08 am

Xline wrote:very cool article

so can we sayed : there is only one implicit parameter(this object) for every class ?

Yes
this is used for example when you have a paramter in function is the same name as a varrible of a class
Code eXample
Code:
public void setX(int x)
{
     this.x=x;
}

here this.x is for class varrible
and just x is for function paramter

Re: Implicit and Explicit Parameters,,,What's the differences?

Fri Jun 08, 2007 12:21 pm

yub actually this is called shadow a variable ,

regarding mt question , actually maybe there is more than one Object called implicit parameter

take look at this :

java code
class A{
B b;
A(){
b= new B();
}
class B{
public String toString() {
return "B";
}

}
void a(){
System.out.println(this);
System.out.println(b);

}

public String toString() {
return "A";
}
public static void main(String[] args){
A a=new A();
a.a();
}

}


Re: Implicit and Explicit Parameters,,,What's the differences?

Fri Jun 08, 2007 12:45 pm

thanks for explanation :lol:

Post a reply
  Related Posts  to : Implicit and Explicit Parameters,,,What's the differences?
 Mark-up Language Differences     -  
 Encoding parameters in URL     -  
 Reference Parameters     -  
 get url, title and url sent parameters with JQuery     -  
 Method Parameters,,,is it by value or reference???     -  
 Send parameters using HTTP GET     -  
 Post parameters using JQuery     -  
 Function with default parameters     -  
 Get values of Form parameters using JQuery     -  
 sending parameters into XSLT sheet     -  

Topic Tags

Java Variables