Ask Question
13 March, 08:17

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.

+3
Answers (1)
  1. 13 March, 11:48
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers