-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment50_.java
More file actions
43 lines (32 loc) · 923 Bytes
/
Assignment50_.java
File metadata and controls
43 lines (32 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package abhilash_Asignments; // Package declaration should follow naming conventions
// Interface defining a method related to Animal
interface Animal
{
void Tiger(); // Interface with abstract method
}
// Class defining a method related to Human
class Human
{
void Men()
{
System.out.println("Human");
}
}
// Subclass extending Human and implementing Animal interface
public class Assignment50_ extends Human implements Animal
{
// Implementing the method from Animal interface
@Override
public void Tiger()
{
System.out.println("Tiger");
}
public static void main(String[] args)
{
// Creating an Object of the subclass
Assignment50_ A1 = new Assignment50_();
// Calling methods from the subclass
A1.Tiger(); // Method from Animal interface
A1.Men(); // Method from Human class
}
}