我用Java编写了一个函数,我希望这个函数返回多个值。除了使用数组和结构,有没有办法返回多个值?在Java中返回多个值
我的代码:
String query40 = "SELECT Good_Name,Quantity,Price from Tbl1 where Good_ID="+x;
Cursor c = db.rawQuery(query, null);
if (c!= null && c.moveToFirst())
{
GoodNameShow = c.getString(0);
QuantityShow = c.getLong(1);
GoodUnitPriceShow = c.getLong(2);
return GoodNameShow,QuantityShow ,GoodUnitPriceShow ;
}
重要的不是“Eclipse”而是语言(Java)。 –
我意识到你的代码是伪Java,但确保你用camelCase命名你的变量(例如'goodNameShow'或'goodUnitPriceShow')。 –