What does the following code do? public class Example { private int var;…
PYQ RPSC Programmer 2024
What does the following code do? public class Example { private int var; public Example(int var) { this.var = var; } }
- A.
Creates a new instance of the class Example.
- B.
Throws an error because this cannot be used.
- C.
Assigns the parameter var to the instance variable var.
- D.
Compilation Error.
- E.
Question not attempted
Attempted by 113 students.
Sign up free to check your answer
Sign up freeLoading lesson…

