-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentstr.java
More file actions
32 lines (28 loc) · 1.15 KB
/
Copy pathStudentstr.java
File metadata and controls
32 lines (28 loc) · 1.15 KB
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
/* String & Object Usage comes here */
public class Studentstr {
String name; // initializing String
String idno; // initializing String
int age;
char div;
public static void main(String[] args) {
Studentstr st1 = new Studentstr(); // object creation
Studentstr st2 = new Studentstr(); // object creation
st1.name = "James Steve"; // string representing
st2.name = "Roger Federer"; // string representing
st1.idno = "3433";
st2.idno = "3434";
st1.age = 21;
st2.age = 22;
st1.div = 'D';
st2.div = 'E';
System.out.println(" ");
System.out.println("DETAILS of Students");
System.out.println(" ");
System.out.println("Idno of Student 1: " + st1.idno + " "); // string printing with whitespace
System.out.println("Name: " + st1.name);
System.out.println("Age & Div: " + st1.age + " " + st1.div);
System.out.println("Idno of Student 2: " + st2.idno + " "); // string printing with whitespace
System.out.println("Name: " + st2.name);
System.out.println("Age & Div: " + st2.age + " " + st2.div);
}
}