How to access a non static method in an abstract class's static method?

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

Was this solution helpful to you?

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.

Just Added Q & A:

Find solution

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.