-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo6.java
More file actions
88 lines (66 loc) · 2.23 KB
/
Demo6.java
File metadata and controls
88 lines (66 loc) · 2.23 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// class Student {
// String name;
// int rollno;
// int marks;
// }
public class Demo6 {
public static void main(String[] args) {
// 20. Array Of Objects In Java
// int newArray[] = new int[4];
// newArray[0] = 5;
// newArray[1] = 74;
// newArray[2] = 65;
// newArray[3] = 85;
// for (int i = 0; i < newArray.length; i++) {
// System.out.println(newArray[i]);
// }
// Student a = new Student();
// a.name = "Tuman";
// a.rollno = 20223045;
// a.marks = 787;
// Student b = new Student();
// b.name = "Bishal";
// b.rollno = 45;
// b.marks = 78;
// Student c = new Student();
// c.name = "Bunny";
// c.rollno = 01;
// c.marks = 98;
// System.out.println(a);
// System.out.println(b);
// System.out.println(c);
// Student students[] = new Student[3];
// students[0] = a;
// students[1] = b;
// students[2] = c;
// for (int i = 0; i < students.length; i++) {
// System.out.println(students[i].name + ": " + students[i].rollno);
// }
// =============================================
// =============================================
// 21. Enhanced For Loop In Java
// int a[] = new int[4];
// a[0] = 56;
// a[1] = 89;
// a[2] = 97;
// a[3] = 79;
// for (int i : a) {
// System.out.print(i + " ");
// }
// System.out.println();
// =============================================
// =============================================
// 22. String In Java
// String str = new String("Tuman");
// System.out.println(str);
// System.out.println(str.charAt(3));
// System.out.println(str.hashCode());
// System.out.println(str.concat(" Sutradhar"));
// =============================================
// =============================================
// 23. Mutable(Change) VS Immutable(Unchanged) String In Java
// String name = "Tuman";
// name = name + " Sutradhar";
// System.out.println(name);
}
}