예외처리
2026년 1월 21일 12:51분
package com.jesusbornd.exodus;
public class Exodus_16_Chapter_Lv2 {
public static void main(String[] args) {
String dailyPortion = "오늘 몫 / Today's portion";
String spoiled = null;
try {
if (spoiled.length() > 0) {
System.out.println("상함 / Spoiled");
}
} catch (NullPointerException e) {
System.out.println("초과 저장은 예외를 만든다 / Over-saving produces an exception");
}
System.out.println(dailyPortion);
}
}
daily_portion = "오늘 몫 / Today's portion"
spoiled = None
try:
if len(spoiled) > 0:
print("상함 / Spoiled")
except TypeError:
print("초과 저장은 예외를 만든다 / Over-saving produces an exception")
print(daily_portion)
Search
Categories
← 목록으로
Comments
결론: 오늘 건 오늘만.