Questions concerning java?
-
stuck on 2 questions about java(polymorphism) Which of the following statements about the static modifier is true A) A static variable cannot change its value B) A static method cannot be overriden to be non-static C) A static method can access static and non-static variables D) A static data member of a class can be seen only by static methods (B ?) A class that is declared final: A) Is inherited by a subclass with all members inherited as private access B) Is inherited by a subclass with all members inherited as protected access C) Is inherited by a subclass with all members inherited as public access D) Is inherited by a subclass just like any class not declared final E) Cannot be inherited by another class (E?)
-
Answer:
For 1st question.. A and B are true.. Static variable cannot change value.. Static methods cannot be overridden, they can be only hidden.. 2nd one E is true final class cannot be subclassed
b at Yahoo! Answers Visit the source
Other answers
for first one even D suits. and second one E is rite..
You are correct for this one: Which of the following statements about the static modifier is true ONLY B. A static value can change its value. A static method cannot access non-static variables (or methods) A static data member can be seen by non-static methods. You are correct for the second one as well. A class that is declared final: ONLY E. You cannot extend a class that is final. Take for example java.lang.Math Try to make a class that extends it. It is good to see you already knew the answers. Good luck with it.
Static function cant call non-static because static are non-volatile while non-static are volatile in easy terms. so the correct answer is B Final keyword is used with classes in java to stop the inheritance , This means this class will not be subclassed, and informs the compiler that it can perform certain optimizations it otherwise could not. It also provides some benefit in regard to security and thread safety. so the correct answer is E.
Related Q & A:
- Where To Get Best AntiVirus For Java Mobile?Best solution by antivirus.com
- How to Implement Gateway Service something similar to Oracle API gateway Using Java and Java based Open Source frameworks only?Best solution by Quora
- How do I erase all the questions in the "My Questions" page?Best solution by Yahoo! Answers
- Difference between Java 2 and Java 6?Best solution by Yahoo! Answers
- A question concerning Civil and Private Law?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.