SHARE
TWEET

Vegetable

a guest Oct 23rd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package healthyHeaven;
  2.  
  3. public class Vegetable {
  4.     private String name;
  5.     private int calories;
  6.  
  7.     public Vegetable(String name, int calories) {
  8.         this.name = name;
  9.         this.calories = calories;
  10.     }
  11.  
  12.     public String getName() {
  13.         return name;
  14.     }
  15.  
  16.     public int getCalories() {
  17.         return calories;
  18.     }
  19.  
  20.     @Override
  21.     public String toString() {
  22.         return String.format(" - %s have %d calories%n",this.name,this.calories);
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top