question 29 of standard test 11:
would class A and TestClass (extends A) have different copies of static variable i? One static variable i belongs to class A and the other belongs to TestClass. When the run methods of Class A and TestClass execute, they should incease their own copy of the static varible i, rather than update the same i?
static variable
Moderator: admin
-
- Site Admin
- Posts: 10066
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: static variable
No, TestClass doesn't declare its own static variable i. so there is no static variable i in TestClass. There is only one in class A. However, since TestClass extends A, you can do TestClass.i but it would still access A's i.
HTH,
Paul.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 137 guests