Computer Applications

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

Java Classes

10 Likes

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.

Answered By

8 Likes


Related Questions