Created
September 21, 2015 04:08
-
-
Save choiseungho/dc1b67d3f23367034de8 to your computer and use it in GitHub Desktop.
자바빈 패턴 -일관성이 훼손 가능하고, 항상 변경이 가능하다.
This file contains 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
package com.tistory.seungdols.effetive.ex_1; | |
/** | |
* @PROJECT effectiveJava | |
* @PACKAGE com.tistory.seungdols.effetive.ex_1 | |
* @WRITTER Administrator | |
* @DATE 2015-09-21 | |
* @HISTORY | |
* @DISCRIPT | |
*/ | |
public class NutritionFactsEx2 { | |
private int servingSize = -1; | |
private int servings = -1; | |
private int calories = 0; | |
private int fat = 0; | |
private int sodium = 0; | |
private int carbohydrate = 0; | |
public NutritionFactsEx2() { | |
} | |
public int getServingSize() { | |
return servingSize; | |
} | |
public void setServingSize(int servingSize) { | |
this.servingSize = servingSize; | |
} | |
public int getServings() { | |
return servings; | |
} | |
public void setServings(int servings) { | |
this.servings = servings; | |
} | |
public int getCalories() { | |
return calories; | |
} | |
public void setCalories(int calories) { | |
this.calories = calories; | |
} | |
public int getFat() { | |
return fat; | |
} | |
public void setFat(int fat) { | |
this.fat = fat; | |
} | |
public int getSodium() { | |
return sodium; | |
} | |
public void setSodium(int sodium) { | |
this.sodium = sodium; | |
} | |
public int getCarbohydrate() { | |
return carbohydrate; | |
} | |
public void setCarbohydrate(int carbohydrate) { | |
this.carbohydrate = carbohydrate; | |
} | |
public static void main(String[] args) { | |
NutritionFactsEx2 coca = new NutritionFactsEx2(); | |
coca.setServingSize(240); | |
coca.setCalories(100); | |
coca.setServings(120); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment