Your own types
Read · 1 of 2
A class bundles values together
A student has a name and marks. A class describes that shape once. The constructor (the part named like the class) runs when you write new Student("Asha", 91), and this.name is this student's own name.
You can put a small class after Main in the same file, without public.
1class Student {2 String name;3 int marks;45 Student(String name, int marks) {6 this.name = name;7 this.marks = marks;8 }9}