This code is from the SCJP study guide with a slight modification. The following code compiles successfully but there is NO output. I was wondering why the statement "Inside getY()" is not generated. Is it because everything inside the local method getY() is erased once out of the method? Still feels like the statement should be output.... Would appreciate any answers.
I have instantiated the class within the method of course. It should give me something because I'm running the method. Tony, I will try calling getX() and see what happens.
Welcome to the Ranch Please note Winston’s point about indentation. Study guides are often incorrectly indented to confuse you about where a bit of code is. Sort out the indentation and you can easily see whether that code is in the method or not.