我用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')。 –