-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathJBeans.java
More file actions
35 lines (33 loc) · 847 Bytes
/
JBeans.java
File metadata and controls
35 lines (33 loc) · 847 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
package advJava;//package advJava;
//
//public class Employee {
// public static void main(String[] args) {
//
// }
//}
import java.util.Scanner;
class JBeans implements java.io.Serializable{
private String name;
private String dept;
JBeans(){}
public void setn(String name, String dept){
this.name=name;
this.dept=dept;
}
public String getn(){
return name;
}
public String getD(){
return dept;
}}
class Employee{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
JBeans obj= new JBeans();
String n=sc.nextLine();
String d=sc.nextLine();
obj.setn(n,d);
System.out.println("Name: "+ obj.getn());
System.out.println("Department: "+ obj.getD());
}
}