ICSE Class 10 Computer Applications Question 24 of 25

Class as Basis of All Computation — Question 24

Back to all questions
24
Question

Question 24

How is following statement different from statement given in previous question ?
Student stud1 = new Student( );

Answer

The statement Student stud1; only declared a variable stud1 of type Student.

The statement Student stud1 = new Student( ); not only declares a variable but it actually instantiates the object stud1 of class Student by using the 'new' keyword.