-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_24_interface.java
More file actions
34 lines (29 loc) · 990 Bytes
/
Copy path_24_interface.java
File metadata and controls
34 lines (29 loc) · 990 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
// collection of abstract methord.
// keyword implements.
// 1- interface methord are by default public and abstract.
// 2- interface variable are by default public static and final.
// 3- interface methord must be overriden inside the implementing classes.
// 4- interface nothing but deals between client and developer.
import java.util.Scanner;
interface _24_interface {
void input(); // public + abstract
void output(); // public + abstract
}
class Raju implements _24_interface {
String name; double sal;
public void input()
{
Scanner r = new Scanner(System.in);
System.out.println("Enter username: ");
name = r.nextLine();
System.out.println("Enter Salary: ");
sal = r.nextDouble();
}
public void output(){
System.out.println(name+" "+sal);
}
public static void main(String[] args) {
_24_interface c = new Raju();
c.input();c.output();
}
}