有沒有辦法在另一個類中使用非靜態公共整數?我想要一些類,其中我有有用的函數和靜態信息,我在不同包的許多其他類中使用這些信息。info.longrandom不起作用,因為它是非靜態的。package common.infopublic class info {public int veryshortrandom = (int)(Math.random() * 500 + 1001);public int shortrandom = (int)(Math.random() * 1000 + 2001);public int mediumrandom = (int)(Math.random() * 1500 + 3001);public int longrandom = (int)(Math.random() * 3000 + 6001);public int verylongrandom = (int)(Math.random() * 6000 + 1201);}我希望得到類似于以下內容的東西:return info.longrandom
有沒有辦法從另一個類調用 public int?
慕田峪9158850
2023-05-10 14:17:02