Stuart A. Burkett wrote:As far as I can see, this has nothing to do with static and non-static methods.
The Stampa class does not contain variables called d1, d2 and d3, so the compiler complains. This will happen whether the stampa() method is static or not.
In your second piece of code, you have moved the print statements to the main method of the Dimostra class and variables called d1, d2 and d3 do exist there.
Ok, i've modified the code in this way and it works:
But why d1/d2/d3 exist only when i put them?
Winston Gutkowski wrote:And how are we supposed to know that? We're good, but we're not mind-readers.
But i've explained the exercise's track in the firs post
Winston Gutkowski wrote:No. 'String' is a type. It can't be static unless the variable (field) that you've assigned it to is static; and the only place you've done that is with the variable Stringa.s.
Can you explain more clearly?
Thanks at all for your help!