Reate a constructor12- create a method called void add int


1-Create a class, call it MyFunction

1.1-create a constructor1.2- create a method called void add( int a, int b) This method will add a and b and assign it to c1.3- create another method printResult to print c

2- create a second class. this will be a subclass extended from MyFunction class2.1- Overload method add (string a, string b) this will concatenate strings a and b and assign it to d.2.2- Overwrite method add (int a,int b) this time it will add a+b+2 and assign it to c

2.3. change method printResult if its needed

Please feel free to change variable names, define new variables.

3- create a test class and demonstrate that all of your methods work correctly.

 

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Reate a constructor12- create a method called void add int
Reference No:- TGS02710313

Now Priced at $10 (50% Discount)

Recommended (91%)

Rated (4.3/5)