import javax.swing.*;
public class PolymorphismSample
{
public static void main (String args[])
{
System.out.print('\f');
int count = Integer.parseInt(JOptionPane.showInputDialog("Enter count:"));
PolymorphismAdd add = new PolymorphismAdd();
//count = add.addCount(count);
//System.out.println("The count is: " + count);
count = add.addCount(count, "Koji");
System.out.println("The count is: " + count);
}
}
==================================================================
//put this in a separate class
import javax.swing.*;
public class PolymorphismAdd
{
public int addCount(int c)
{
c = c + 1;
return c;
}
public int addCount(int c, String n)
{
c = c + 2;
return c;
}
}