我是一個Java新手,這是一個真正的基本問題,所以請不要 錯過樹林。 我只需要知道如何訪問從方法如何從Java方法返回後訪問返回數據
private static int toInt(String number)
{
int multiplicand = 0;
// do stuff to figure out a multiplicand
return multiplicand;
}
public static void main(String[ ] args)
{
int anotherVariable = 53;
toInt(args[ 0 ]);
所以回來的數據,有什麼事我在這裏說,我回來後從toInt方法,以便訪問是什麼被乘數?
可以說我想乘以multiplicand * anotherVariable中返回的內容。 我不能使用被乘數,因爲編輯器只是說「不能將多個乘法器解析爲變量」。非常感謝所有偉大的程序員耐心地容忍我們的新手。
+1:但有另一個樣子,他傳遞了args [0]這是一個String。 – 2012-08-01 01:21:34
@DonRoby thanx ... – hvgotcodes 2012-08-01 01:22:02
@hvgotcodes - 非常感謝你 – 2012-08-01 02:31:36