Ask Question
17 May, 19:22

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.

+4
Answers (1)
  1. 17 May, 22:06
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers