1.

How are automatic variables different from the instance variables?(a) Automatic variables are initialized automatically but instances are not(b) Automatic variables are given zero values initially and not instances(c) Instance variables have to be initialized explicitly and automatic implicitly(d) Instance variables are initialized implicitly while automatic are notThe question was posed to me in my homework.This intriguing question originated from Automatic Variable in chapter Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

Correct choice is (d) Instance variables are initialized IMPLICITLY while AUTOMATIC are not

Explanation: The automatic variables have to be initialized EXPLICITLY. But in case of instances, those are initialized automatically during execution of the PROGRAM. The conventions are mandatory.



Discussion

No Comment Found

Related InterviewSolutions