Question: Which one is correct about the following class? public class TestClass { int instanceVariable; public void setInstanceVariable ( int passedInstanceVariable ) { instanceVariable = passedInstanceVariable;

Which one is correct about the following class?
public class TestClass {
int instanceVariable;
public void setInstanceVariable(int passedInstanceVariable){
instanceVariable = passedInstanceVariable;
}
}
We cannot create objects from this class because it does not have any constructor.
We can create objects from this class because object creation does not necessarily need a constructor.
We can create objects from this class because it is non-static.
We can create objects from this class because "Object" class has a default constructor
None of them

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!