This is a lesson in encapsulation. Your issue, as @salihrkc said, is that you're never actually setting the length variable which exists in your "Extension" object. If you try to print "length" as passed in to your object, you'll see it's getting there just fine.
You act on your object using the dot operator (e.g. extension.messages(length);
, to call the messages method). The key points you should be realizing is that you cannot set the objects length by just doing extension.theLength = length;
. This is because of the private modifier. Instead you should be using the "getter" and "setter" methods. These functions exist within your object and therefore access to the private variables, so you can do something like extension.setLength(length);
and System.out.println(extension.getLength());
Check out the two sources I linked, they'll help.
Good luck.