MCQ - Object Oriented Programming

why is the question 3 giving me compiler error?

Hi Manish
In OOPS, Classes have private variables by default which can not be accessible outside the class.
If you want to access the variables outside the class, you have to use “public” in the class for the variables you want to access.
Use “public” at the beginning of the class & you are good to go.

If you have any other doubt, feel free to ask again.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Practice MCQ ( Multiple Choice Questions ) here on Letsfindcourse which will help you to clear your concepts and also to prepare for technical rounds, interviews, competitive exams etc.