Examlex

Solved

Consider the Following Class Definitions.public Class BClass

question 25

Multiple Choice

Consider the following class definitions.public class BClass
{
Private int x; public void set(int a) { x = a; } public void print() { }
}public class DClass extends BClass
{
Private int y; public void set(int a, int b)
{
//Postcondition: x = a; y = b;
}
Public void print() { }
}Which of the following is the correct definition of the method set of the class DClass?(i)
Public void set(int a, int b)
{
Super.set(a) ;
Y = b;
}(ii) public void set(int a, int b)
{
X = a;
Y = b;
}


Definitions:

Opiate

A class of drugs derived from opium, used for their pain-relieving properties, but also known for their potential to cause dependency and addiction.

Heroin

An opioid drug derived from morphine, highly addictive and illegal in most countries.

LSD

Lysergic acid diethylamide, a powerful hallucinogenic drug known for altering perception, mood, and various cognitive processes.

Psychedelic

Substances that produce altered states of consciousness, characterized by changes in perception, mood, and thought.

Related Questions