我正在學習Java,我正在使用BlueJ編寫返回currentTimeInMillis()的方法,而y < 100.此刻,我收到一個錯誤聲明「缺少回報聲明」。任何建議重新錯誤/代碼?Java - for循環currentTimeInMillis() - BlueJ
import java.lang.System;
public class Math
{
// instance variables - replace the example below with your own
private int y;
/**
* Constructor for objects of class Math
*/
public Math()
{
// initialise instance variables
y = 0;
}
/**
* An example of a method - replace this comment with your own
*
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public static long currentTimeMillis()
{
// put your code here
for (int y = 0; y<100; y++)
{return y;
}
System.out.println(System.currentTimeMillis());
}
}
:)我仍然很新,在此,非常感謝。 – user3289631