Ask Question

If you have defined a class named SavingsAccount with a public static data member named numberOfAccounts, and created a SavingsAccount object referenced by the variable account20, which of the following will assign numberOfAccounts to numAccounts?

A) numAccounts = SavingsAccount. numberOfAccoun ts; B) numAccounts = numberOfAccounts; C) numAccounts = account20. numberOfAccounts; D) None of the above, you cannot reference a static data member.

+2
Answers (1)
  1. 17 March, 12:33
    0
    numAccounts = SavingsAccount. numberOfAccounts

    Explanation:

    In object oriented programming, when you have created an object of class, you can create several instances (objects) from that class by referencing the className. classFeild. In this instance SavingsAccount is the class name and

    numberOfAccounts is a feild (or data member). to create a new numAccount, we use the syntax as above in the answer
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “If you have defined a class named SavingsAccount with a public static data member named numberOfAccounts, and created a SavingsAccount ...” 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