JAVA import静态类的方法
public static int getStoredTicketCount() {
int result = 0;
StorageMap s = new StorageMap(Storage.getLocalStorageIfSupported());
String ticketCount = s.get(TICKETCOUNT_KEY);
if (ticketCount != null) {
result = Integer.parseInt(ticketCount);
}
return result;
}
在另一个类中调用该方法,
import cn.gxpo.repo.widgetset.client.OfflineDataService.getStoredTicketCount;
报错。后改成:
import static cn.gxpo.repo.widgetset.client.OfflineDataService.getStoredTicketCount;
注意加上了static
正常。