订餐回馈
BETA:无法编译——String类型无法转换为Boolean类型(待解决)
class Dinner{ String meat="beef"; String vegetable="potato"; String soup="tomato"; String fruit="apple"; String drinking="coke"; void ding(){ if(meat="none"||vegetable="none"||soup="none"||fruit="none"|| drinking="none"){ System.out.println("Holy shit MOMTHER F**K!"); } else{ System.out.println(meat+"/t"+vegetable+"/t"+soup+"/t"+fruit +"/t"+drinking); } }}class DinnerSupply{ public static void main(String[] args){ Dinner a=new Dinner(); a.drinking="none"; a.ding(); }}
Ver1.0
引入调用匿名对象
基础功能——自定义配菜
class Dinner{ String meat="beef"; String vegetable="potato"; String soup="tomato"; String fruit="apple"; String drinking="coke"; void ding(){ System.out.println(meat+" "+vegetable+" "+soup+" "+fruit +" "+drinking); }}class DinnerSupply{ public static void main(String[] args){ Dinner a=new Dinner(); a.drinking="none"; a.ding(); new Dinner().ding(); }}
Ver2.0
你的午餐呢?
class Dinner{ String meat="beef"; String vegetable="potato"; String soup="tomato"; String fruit="apple"; String drinking="coke"; void ding(){ System.out.println(meat+" "+vegetable+" "+soup+" "+fruit +" "+drinking); }}class DinnerSupply{ public static boolean dinnerThief(Dinner x){ x.meat="none"; x.vegetable="none"; x.soup="none"; x.fruit="none"; x.drinking="none"; return true; } public static void main(String[] args){ Dinner a=new Dinner(); a.drinking="none"; a.ding(); new Dinner().ding(); dinnerThief(a); if(dinnerThief(a)){ System.out.println("HOLY SHIT MOTHER F**K!"); } }}