We have the following class:

class Banana

{

private:

string s;

int y;

public:

bool theMemberFunc (string);

void setterForS(string); // setter for s

string getterForS(); // getter for s

};

Instantiate a static object of Banana named co.

a)int Banana;

b)co.Banana = new;

c)Banana = new class;

d)Banana co;

Respuesta :

Answer:

The correct answer is d) Banana co;

Explanation:

In Java everything is an object, for example when we declare a variable x of type int we usually do in this way, determine the class we are going to instance and then the name of our object:

  • int x;

On the example  above we instantiate an object of int named x.

For this exercise we have to instantiate an object of type Banana that is going to be named co.

  • Banana co;

Otras preguntas