Search This Blog

Monday, April 7, 2025

Java - this keyword - 1

 In Java, this keyword can be used in more than one way. Does the program below accurately use this keyword?

What happens when you run this code?


a) Compile time error - invalid use of this at line 18

b) Runtime error - invalid nested call to a constructor

c) Program prints - hello

d) Program prints - hi


Type your answer in the comment.


Follow and share my blog for more interesting posts on programming and DS.



2 comments: