- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEx11ClassConst.java
More file actions
Latest commit
19 lines (15 loc) · 553 Bytes
/
Copy pathEx11ClassConst.java
File metadata and controls
19 lines (15 loc) · 553 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
packageJavaEntry;
publicclassEx11ClassConst { // Createing a class
intx;
Stringtext;
Stringtotal;
publicEx11ClassConst(inty, Stringcontent){ // Createing a class constructor
x = 10; // Assign value in class attribute
total = content + x + y;
}
publicstaticvoidmain(String[] args){
Ex11ClassConstconstObj = newEx11ClassConst(5, "The total value is "); // we can pass value to the constructor
System.out.println(constObj.x);
System.out.println(constObj.total);
}
}