*Based on answer choices A-E, what is the correct option?
4. Given the following code, which is the correct way to create an object using the
parameterized constructor?
class Elmo
{
int age;
double length;
char model;
Elmo(int a, double l, char m) { age = a; length = l; model = m; }
}
A. Elmo e1 = new Elmo('Y', 5.6, 7);
B. Elmo e1 = new Elmo(5.6, 'Y', 7);
C. Elmo e1 = new Elmo(7, 'Y', 5.6);
D. Elmo e1 = new Elmo(5.6, 7, 'Y');
E. Elmo e1 = new Elmo(7, 5.6, 'Y');
E. Elmo e1 = new Elmo(7, 5.6, 'Y');
Comments
Leave a comment