static variable

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
user

static variable

Post by user »

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?

admin
Site Admin
Posts: 10066
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: static variable

Post by admin »

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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 222 guests