Q3)Which of the following are valid member variable declarations? a] abstract int i; b] final int i; c] final volatile int i; d] public transient final i e] protected static final int i Q4)Which of the following are true regarding interfaces? a] All methods in an interface are public,abstract and static b] All interface methods should have public accessibility when implemented in class c] All variables in an interface are public,static and final d] interfaces can have constructors e] It is valid to declare the methods explicitly in an interface as static.
Amit, Please post one question per thread. Trying to discuss too many things under one topic will convolute the discussion and cannot be of much help to anyone! Also, when you post questions, think aloud and tell us what you think. Try to answer the question and analize why those answers are right or wrong. This way others can help you re-orient your way of thinking. These comments apply to all other messages posted by you. You may edit your old messages to separate the questions, or simply post new messages. Thanks! Ajith
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Joined: Dec 05, 2000
Here are my answers to the questions:
q3) I think that all the answers are false because a variable cannot be abstract and final variables have to be initialized when they are declared. Q4) a) false : methods in an interface cannot be static. b) true : while overriding methods the accessibility cannot be made more restrictive. c) true : variables in an interface are implicitly public, static and final. d) false : interfaces cannot be instantiated. So constructors don't come into picture. e) false : same reason as in a).
I think we can still allow final variables to be declared as posted above, since if they are not initialized, they have to be initialized in the constructors or initializer expressions. I don't think such vague Q.s are asked!!!
Sun Certified Programmer for Java 2 Platform
Joined: Feb 01, 2001
volatile variables cannot be final!!! So only option b is correct!!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com