0
Classes and objects
So to access any part of a class or reference the class itself, you need to create an object right. Like if I had class Student, I would need to create an object, like Student s1 = new Student() to access that class. Also this may be a dumb question but why are we writing the Student class twice to make an object.
2 Answers
+ 2
Student s1 = new Student();
^
specifies that the type of variable s1
Student s1 = new Student();
^
means that we initialize the object of class Student that will be assigned to s1.
0
Or you may create a static object and do not initialize it