Ask Question
24 June, 00:26

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;

+2
Answers (1)
  1. 24 June, 02:53
    0
    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;
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “We have the following class: class Banana { private: string s; int y; public: bool theMemberFunc (string); void setterForS (string); / / ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers