Skip to content

Commit 8235860

Browse files
committed
added new class
1 parent 1665176 commit 8235860

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

bin/constructors/Constructors1.class

1.41 KB
Binary file not shown.

src/constructors/Constructors1.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package constructors;
2+
3+
class Constructors1 {
4+
String name;
5+
int roll;
6+
double fee;
7+
8+
Constructors1(String name, int roll, double d) {
9+
this.name = name;
10+
this.roll = roll;
11+
this.fee = d;
12+
}
13+
14+
void display() {
15+
System.out.println(name + " " + roll + " " + fee);
16+
}
17+
18+
public static void main(String[] args) {
19+
Constructors1 s1 = new Constructors1("Masum", 1526, 50.05);
20+
Constructors1 s2 = new Constructors1("Raza", 1525, 25.05);
21+
Constructors1 s3 = new Constructors1("Sonu", 1524, 200.05);
22+
Constructors1 s4 = new Constructors1("Sahili", 1527, 305.05);
23+
s1.display();
24+
s2.display();
25+
s3.display();
26+
s4.display();
27+
}
28+
}

0 commit comments

Comments
 (0)