Method (computer programming): Difference between revisions

Content deleted Content added
Line 18:
 
<syntaxhighlight lang="java">
public class class1 {
int f(int x) {
{
int f(int x)
{
return x+3;
}
}
 
public class class2 extends class1 {
{
@Override
int f(int x) // overriding {
{
return x*x;
}
int f(int x, int y) {// overloading
{
return x*y;
}