【发布时间】:2012-11-03 19:33:27
【问题描述】:
我用 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)。