[英]Transfer int values from one class to another
Main Class: http://gyazo.com/0a77cdba8a876eb2f8e0b8576d9c336c 主类: http : //gyazo.com/0a77cdba8a876eb2f8e0b8576d9c336c
Class calling the int: http://gyazo.com/bb8d8532a9a93491f97122cba4a8c331 调用int的类: http : //gyazo.com/bb8d8532a9a93491f97122cba4a8c331
It claims the int does not exist... 它声称int不存在...
You are declaring it in a local context, so it is only visible within the main method. 您在本地上下文中声明它,因此它仅在main方法中可见。 Try setting it as a class property.
尝试将其设置为类属性。
Your variable a was declared in the Main method (so it is local to that method). 您的变量a是在Main方法中声明的(因此它是该方法的局部变量)。 You might get that variable value to the "called class" several different ways (not sure which may apply, provide full code):
您可能会通过几种不同的方式将变量值添加到“被调用的类”中(不确定哪种方法适用,请提供完整的代码):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.