Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

method overloading

Status
Not open for further replies.

satellite03

IS-IT--Management
Dec 26, 2003
248
IN
hi , here i have a question...

can i do the following?

Code:
public class First{ 

static int x; 

[COLOR=red]public void method(int y){ [/color]

x = y; 

} 

} 

public class Second extends First{ 

{

//blah

[COLOR=blue]public void method(String x){} [/color]

//blah
}
}
are thses two methods legal? you see parameters are not same (one is "int" other is "String")... does overloading permit this?
about overloading i understand two method may have different code inside it....but does the above code legal??

question2
---------

its not clear to me about the native method() ? can anybody tell me where i should use it?
 
yes, it is legal, but the methods are different.

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top