-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstructor.java
More file actions
41 lines (35 loc) · 864 Bytes
/
constructor.java
File metadata and controls
41 lines (35 loc) · 864 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
package com.company;
class MyMainEmployees{
private int id;
private String name;
public MyMainEmployees(int id, String name) {
this.id = id;
this.name = name;
}
// public MyMainEmployees() {
// this.id = 0;
// this.name = "Your-name-here";
// }
//
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
public class constructor {
public static void main(String[] args) {
MyMainEmployees m1=new MyMainEmployees(32,"Rahul");
// m1.setId(12);
// m1.setName("Rahul");
System.out.println(m1.getId());
System.out.println(m1.getName());
}
}