Created
December 8, 2015 12:24
-
-
Save mindwing/6840858a579d0dccfd9e to your computer and use it in GitHub Desktop.
printf() 메서드 사용예입니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by mindwing on 2015-12-08. | |
*/ | |
class SinsaApt2 { | |
int floorCount; | |
int parkingLotCount1; | |
int parkingLotCount2; | |
int evelatorCount; | |
int getTotalParkingLotCount() { | |
return parkingLotCount1 + parkingLotCount2; | |
} | |
} | |
public class D4_OOP2 { | |
public static void main(String[] args) { | |
SinsaApt2 apt2001 = new SinsaApt2(); | |
apt2001.floorCount = 20; | |
apt2001.parkingLotCount1 = 15; | |
apt2001.parkingLotCount2 = 20; | |
apt2001.evelatorCount = 1; | |
// System.out.println("총 주차대수: " + apt2001.getTotalParkingLotCount()); | |
System.out.print("총 주차대수: " + apt2001.getTotalParkingLotCount()); | |
System.out.println("\n첫 번째 주차대수: " + apt2001.parkingLotCount1); | |
System.out.println("두 번째 주차대수: " + apt2001.parkingLotCount2); | |
System.out.printf("주차현황: 주차장1=%s, 주차장2=%s\n" | |
, apt2001.parkingLotCount1, apt2001.parkingLotCount2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment