0%
0 / 15 answered

Introduction to Algorithms, Programming, and Compilers Practice Test

15 Questions
Question
1 / 15
Q1

In the bank account scenario, constructors initialize an object’s data when it is created. The class stores balance as a private field, and methods are invoked on a specific object:


public BankAccount(double start) {

  balance = start;

}

BankAccount c = new BankAccount(200.0);

Based on the passage, what does the constructor primarily do for each new BankAccount object?​

Question Navigator