-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_42.java
More file actions
41 lines (41 loc) · 993 Bytes
/
Main_42.java
File metadata and controls
41 lines (41 loc) · 993 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
class Student4{
private int id;
private String name;
public void setName(String n){
name=n;
}
public void setId(int i){
id=i;
}
public String getName(){
return name;
}
public int getId(){
return id;
}
public Student4(String nam, int idd){
id=idd;
name=nam;
}
public Student4(){
id=67;
name="Your name:";
}
}
public class Main_42 {
public static void main(String[] args) {
Student4 ram = new Student4("ram", 90);
//ram.setName("Wali");
//ram.setId(67);
System.out.println(ram.getName());
System.out.println(ram.getId());
Student4 tom=new Student4();
System.out.println(tom.getName());
System.out.println(tom.getId());
Student4 susan= new Student4();
susan.setName("Wali");
susan.setId(34);
System.out.println(ram.getName());
System.out.println(ram.getId());
}
}