
5.4 Class Objects and Methods
Line Nos. 5 to 8: declare attributes like roll number, name, totalMarks and
grade. As we have not declared access specifiers, these are consid-
ered public inside the package. This means that all the classes within
the package can access these attributes.
Line No. 10: declares a class
StudentDemo with public static void() at Line No. 11.
This means that is our main class and our program is thus named
StudentDemo.java. This is also called a driver program for
class Student2
Line No. 13: Student1 std = new Student1();creates an object of class
Student1 named std. New statement allocates memory for Student
object ...