-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathStudent.java
More file actions
53 lines (44 loc) · 917 Bytes
/
Student.java
File metadata and controls
53 lines (44 loc) · 917 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
43
44
45
46
47
48
49
50
51
52
53
package StudentClass;
import java.util.Arrays;
import java.util.Random;
import java.util.List;
public class Student
{
private int ID;
static int counter = 0;
private String Name;
private static final Random r = new Random(Integer.MAX_VALUE);
private static List<String> names = Arrays.asList("Ram","Ajay","Arjun","Ravi","Sanju");
public Student(int ID,String Name)
{
this.ID=ID;
this.Name=Name;
}
public int getID()
{
return ID;
}
public void setID(int iD)
{
ID = iD;
}
public String getName()
{
return Name;
}
public void setName(String name)
{
Name = name;
}
@Override
public String toString()
{
return "Student [id=" + ID + ", name=" + Name + "]";
}
public static Student create()
{
Student obj = new Student(r.nextInt(),names.get(counter));
counter++;
return obj;
}
}