Campbell Ritchie wrote:Welcome to the Ranch
That array is written as a local variable inside the main method and it has no existence outside that method. You will have to move it out of the main method, and provide methods which allow it to be accessible from other code.
Jesper de Jong wrote:Make the method 'metodas' return the value instead of void, and then save the result of the method in the main method.
This Oracle Java tutorial explains how to do that: Returning a Value from a Method
bob john wrote:
Looking into oracle docs ends in more confusion. Because I dont understand anything.
Finish the code please.
Nearly the same; it started off being unable to pass something from the main method to another method, and now it is inability to pass something from another method to the main method. But they are so similar that I think it is worth merging the two discussions.Henry Wong wrote:. . . it looks like this topic is just the exact same issue as your other topic... . . .
bob john wrote:
/*of course I could just copy and paste "int ui = 10" to main class. But I dont want, because this is with diffrend purpose. I want "transfer" variable ui from 'class two' to ' class one'. */
bob john wrote:But there is things such as "polimorphism' and "composition".
If you can do with 'static', I dont mind it is fine.
Don't get me started about those stupid light bulbs. |