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?
- A.
Create an object test with var = 0 and myString = "Default"
- B.
Throw a runtime exception
- C.
Create an object test with var = 0 and myString = null
- D.
Throw a compilation error
- E.
Question not attempted
Attempted by 27 students.
Sign up free to check your answer
Sign up freeLoading lesson…

