Consider the following class definition: public class Test { int var; String…

PYQ RPSC Programmer 2024

Consider the following class definition: public class Test { int var; String myString; public Test() { this(0, "Default"); } public Test(int var, String myString) { this.var = var; this.myString = myString; } } What will the following code do?

  1. A.

    Create an object test with var = 0 and myString = "Default"

  2. B.

    Throw a runtime exception

  3. C.

    Create an object test with var = 0 and myString = null

  4. D.

    Throw a compilation error

  5. E.

    Question not attempted

Attempted by 27 students.

Sign up free to check your answer

Sign up free

Explore the full course: Rpsc Programmer

Loading lesson…