-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprat.java
More file actions
48 lines (39 loc) · 995 Bytes
/
Copy pathprat.java
File metadata and controls
48 lines (39 loc) · 995 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
public class prat {
int roll;
String name;
double marks;
prat() {}
prat(int roll) {
this.roll = roll;
}
prat(int roll, String name) {
this.roll = roll;
this.name = name;
}
prat(int roll,String name, double marks) {
this.roll = roll;
this.name = name;
this.marks = marks;
}
void displayinfo() {
System.out.println(roll);
System.out.println(name);
System.out.println(marks);
}
public static void main(String[] args) {
prat p2 = new prat();
prat p = new prat(101);
prat p1 = new prat(101, "mohith");
prat p3 = new prat(101, "mohith", 100);
p.displayinfo();
p1.displayinfo();
p3.displayinfo();
p2.displayinfo();
}
}
// 10 30 static block
// main method
// 30 static method
//40 instance block
// constructor 20
//40 instance method