Ask Question

If you have defined a class SavingsAccount with a public static method getNumberOfAccounts (), and created a SavingsAccount object referenced by the variable account20, which of the following will call the getNumberOfAccounts () method?

A. getNumberOfAccounts ();

B. SavingsAccount. getNumberOfAccounts ();

C. getNumberOfAccounts (account20);

D. None of the above, you cannot call a static method.

+2
Answers (1)
  1. 6 November, 14:52
    0
    The correct answer to this question is "Option B".

    Explanation:

    In this question, it is defined that a class "SavingsAccount" declare is in this class a method that is "getNumberOfAccounts () " is defined, which created a class object reference variable "account20". The class uses a static method that is called by class name, and other options are wrong that can be described as follow:

    In option A, It is not correct because it does not use the object. In option C, It is wrong because it uses parameters.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “If you have defined a class SavingsAccount with a public static method getNumberOfAccounts (), and created a SavingsAccount object ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers