-3
我想知道靜態文件在我的文件中的含義。每次,我遇到一個錯誤,然後發現單詞靜態錯過了。你能否解釋何時何地應該使用靜態詞。使用Static示例
這裏,例如在代碼中,即使我從變量中刪除靜態,它也會顯示錯誤。
是,它是靜態類,所以它必須是靜態變量?
public class TestJavaServer {
static String xCordinate;
public static void main(String[] args)
{
readFromFile();
}
public static void readFromFile() throws IOException
{
xCordinate ="something";
}
'static'意味着綁定到類,而不是對象(在Java中的上下文中) – mangusta
靜態方法只能訪問靜態字段。 –
不要冷落,老兄從零開始學習Java –