Skip to content

Latest commit

 

History

History

Java Inheritance II

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Java HackerRank

Difficulty Max Score Success Ratio
Easy 10 97.66%

Write the following code in your editor below:

  1. A class named Arithmetic with a method named add that takes [SVG image] integers as parameters and returns an integer denoting their sum.
  2. A class named Adder that inherits from a superclass named Arithmetic.

Your classes should not be be [SVG image] .

Input Format

You are not responsible for reading any input from stdin; a locked code stub will test your submission by calling the add method on an Adder object and passing it [SVG image] integer parameters.

Output Format

You are not responsible for printing anything to stdout. Your add method must return the sum of its parameters.

Sample Output

The main method in the Solution class above should print the following:

My superclass is: Arithmetic
42 13 20

💡 Hints

➡️ Approach

✅ Detailed Solution

View Solution : Java Inheritance II

Submissions Leaderboard Discussions Editorial
📝 My Submission 🏆 Track our position 🤔 Help from Community ✍️ Editorial