Add new default method

Report a typo

There is an interface Flying that has a method getHeight returning the height of flying in meters. Add and implement a default method getHeightInKm that returns height of flying in kilometers.

Sample Input 1:

1000

Sample Output 1:

1
Write a program in Java 17
interface Flying {
// returns height of flying in meters
int getHeight();

// implements a default method getHeightInKm that returns height of flying in km as int type
}
___

Create a free account to access the full topic