Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package healthyHeaven;
- public class Vegetable {
- private String name;
- private int calories;
- public Vegetable(String name, int calories) {
- this.name = name;
- this.calories = calories;
- }
- public String getName() {
- return name;
- }
- public int getCalories() {
- return calories;
- }
- @Override
- public String toString() {
- return String.format(" - %s have %d calories%n",this.name,this.calories);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement