Java is not like basic... the code is not executed line by line. in your original post, NO SINGLE LINE OF YOUR CODE would be executed, until somebody created a whatHappend object. i could write, in MY code
at this point, i would have a reference to a hunk of memory that has a whatHappened object. the "new whatHappend()" would cause a spot in memory to be allocated, with enough room to hold the two variables. also, if this is the first time anybody has created on of these, a special place in memory is reserved for the METHODS of the class...
in other words, if i create 300 objects of this type, there are 300 sets of the i and j in memory. but the methods are only stored once.
so when does the f() method run? at any time in my code where i do something like:
myVariable.f();
NOW that code will run. due to other reasons we probably don't need to go into here, how you have this written, the i and j that my object are holding will not change, but that's another
thread topic.