But nPrint isn't a method of any of the classes in the standard Java API. So it must be a method of some other class. Which means we know nothing except that you're asking about a method named "nPrint". Please read this: TellTheDetails and then post some information about just what is confusing you.
Please UseCodeTags when posting code. It will highlight your code and make it easier to read. It probably will also increase the number of people helping you.
Try to TellTheDetails in advance. That way we don't have to ask you for more information and nobody is wasting time.
The keyword is scope. If you declare a variable then it has a scope. It is visible (in scope) between the two brackets it is declared in. After that it's no longer in scope and can't be accessed. So after your method has run the variable k is out of scope and can't be reached.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
I'm not sure if I approve of this interruption. But this tiny ad checks out: