int无法解除引用错误消息 [英] int cannot be dereferenced error message
问题描述
推荐答案
我想你想写这个:
I think you meant to write this:
您的代码中还有几个逻辑错误需要注意。在Number类中,您创建一个充满Number对象的数组 - 如果继续创建非空数组,则可能导致无限循环。我认为你的意思是用户交互代码在其他地方,也许在主要方法中,但尚未出现。你还有一个名为Number的int数组 - 你肯定是纯粹的混淆吗?
There are also several logical errors in your code that you need to attend to. In your Number class you create an array full of Number objects -- that could lead to an infinite loop if you keep creating non-empty arrays. I think you meant the user interaction code to be elsewhere, perhaps in the main method, which hasn''t shown up, yet. Also you have an int array called Number -- surely pure confusion on your part?
你的代码中还有几个逻辑错误你需要照顾。在Number类中,您创建一个充满Number对象的数组 - 如果继续创建非空数组,则可能导致无限循环。我认为你的意思是用户交互代码在其他地方,也许在主要方法中,但尚未出现。你还有一个名为Number的int数组 - 你肯定是纯粹的混乱吗?
There are also several logical errors in your code that you need to attend to. In your Number class you create an array full of Number objects -- that could lead to an infinite loop if you keep creating non-empty arrays. I think you meant the user interaction code to be elsewhere, perhaps in the main method, which hasn''t shown up, yet. Also you have an int array called Number -- surely pure confusion on your part?
是的,我的意思是(int i = 0; i< numNumber; i ++);忘记int那里。
在属性列表中我想创建一个数字对象数组然后在构造函数中我会提示用户输入数字对象的数量并使用for循环使用每个数字构造函数来实例化每个数字帐户。
主方法中的
我将实例化两个数字对象。
问题我正在进行for循环并得到错误 int无法解除引用错误消息我知道我必须对它做一些事情,因为它是一个原始的,只是不知道如何在数组和循环中。
Yeah, I meant for (int i = 0; i < numNumber; i++); forget the int there.
in the attributes list I wanted to make an array of number objects then in the constructor I would prompt the user for the number of number objects and use a for loop to instantiate each number account using the number constructor for each.
in the main method I would just instantiate two number objects.
The problem I''m having is in the for loop and getting the error " int cannot be dereferenced error message" I know I have to do something with it because it''s a primitive, just don''t know how in an array and for loop.
这篇关于int无法解除引用错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!