From 9ad46d11e1d7e610d29c8e9e1778c2ec352d75c6 Mon Sep 17 00:00:00 2001 From: bingor_yhj Date: Wed, 5 Oct 2022 23:03:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9D=A6=E5=85=8B=E5=A4=A7=E6=88=98(=E4=B8=80?= =?UTF-8?q?=E6=9C=9F)-=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E4=BD=BF=E7=94=A8-1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/msb/PropertyMgr.java | 4 ++++ src/com/msb/TankDemo.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/msb/PropertyMgr.java b/src/com/msb/PropertyMgr.java index 0570e0f..50e5351 100644 --- a/src/com/msb/PropertyMgr.java +++ b/src/com/msb/PropertyMgr.java @@ -26,6 +26,10 @@ public class PropertyMgr { return props.get(key); } + public static String getString(String key) { + return (String) get(key); + } + public static void main(String[] args) { System.out.println(get("initTankCount")); } diff --git a/src/com/msb/TankDemo.java b/src/com/msb/TankDemo.java index e657abc..b9e0274 100644 --- a/src/com/msb/TankDemo.java +++ b/src/com/msb/TankDemo.java @@ -14,7 +14,7 @@ public class TankDemo { TankFrame tankFrame = new TankFrame(); Random random = new Random(); - int initTankCount = Integer.parseInt((String) PropertyMgr.get("initTankCount")); + int initTankCount = Integer.parseInt(PropertyMgr.getString("initTankCount")); //创建5个敌方坦克 for (int i=0; i