Skip to content

Commit bde055b

Browse files
authored
Add files via upload
1 parent 63e6104 commit bde055b

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.util.Scanner;
2+
interface Number {
3+
int findCube(int i); // Returns the cube of a number
4+
}
5+
6+
7+
//Create a class A which implements the interface Number.
8+
class A implements Number
9+
{
10+
public int findCube
11+
(int num)
12+
{
13+
return num*num*num;
14+
}
15+
}
16+
17+
18+
public class Question5{
19+
public static void main (String[] args){
20+
A a = new A(); //Create an object of class A
21+
// Read a number from the keyboard
22+
Scanner sc = new Scanner(System.in);
23+
int n = sc.nextInt();
24+
System.out.print(a.findCube(n));
25+
}
26+
}

0 commit comments

Comments
 (0)