자바 Abstract관련 소스코딩중 잘 되지 않아 질문 드립니다. Mobile.java ============================================================================================== public abstract class Mobile { private String mobileName; private int batterySize; private String osType; public Mobile() { } public Mobile(String mobileName, int batterySize, String osType) { this.mobileName = mobileName; this.batterySize = batterySize; this.osType = osType; } public String getMobileName() { return mobileName; } public void setMobileName(String mobileName) { this.mobileName = mobileName; } public int getBatterySize() { return batterySize; } public void setBatterySize(int batterySize) { this.batterySize = batterySize; } public String getOsType() { return osType; } public void setOsType(String osType) { this.osType = osType; } public abstract int operate(int time); public abstract int charge(int time); } MobileTest.java =========================================================================================== import com.mobile.OTab; public class MobileTest { public static void main(String[] args) { OTab ot = new OTab("OTab", 1000, "AND-20"); System.out.println(" Mobile\t\tBattery\t\tOS"); System.out.println("---------------------------------------------"); System.out.println(ot.getMobileName()+ "\t\t" + ot.getBatterySize() + "\t\t" + ot.getOsType()); System.out.println("---------------------------------------------"); System.out.println(); System.out.println("10분 충전"); ot.charge(10); System.out.println(" Mobile\t\tBattery\t\tOS"); System.out.println("---------------------------------------------"); System.out.println(ot.getMobileName()+ "\t\t" + ot.getBatterySize() + "\t\t" + ot.getOsType()); System.out.println("---------------------------------------------"); System.out.println(); System.out.println("5분 통화"); ot.operate(5); System.out.println(" Mobile\t\tBattery\t\tOS"); System.out.println("---------------------------------------------"); System.out.println(ot.getMobileName()+ "\t\t" + ot.getBatterySize() + "\t\t" + ot.getOsType()); System.out.println("---------------------------------------------"); } } OTab.java ============================================================================================= import com.mobile.Mobile; class OTab extends Mobile{ public OTab(){ super(); } public OTab(String mobileName, int batterySize, String osType){ super(mobileName, batterySize, osType); setBatterySize(batterySize); setMobileName(mobileName); setOsType(osType); } public int operate(int time){ int a = time*12; return getBatterySize()-a; } @Override public int charge(int time) { int b = time*10; return getBatterySize()+b; } } 위 Mobile.java와 MobileTest.java를 사용하여 OTab.java를 구현하는 건데요.. 다음과 같이 구현해봤는데, 값이 모두 Null로 나오네요.. 문제가 뭘까요..?
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.