Advertisement
Guest User

LizardClass

a guest
Mar 28th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.65 KB | None | 0 0
  1. public class LizardClass {
  2.     String _name;
  3.     float _weight;
  4.  
  5.     public LizardClass(String name, float weight) {
  6.         _name = name;
  7.         _weight = weight;
  8.     }
  9.  
  10.     public String getName() {
  11.         return _name;
  12.     }
  13.     public void setName(String name) {
  14.         _name = name;
  15.     }
  16.     public float getWeight() {
  17.         return _weight;
  18.     }
  19.     public void setWeight(float weight) {
  20.         _weight = weight;
  21.     }
  22.  
  23.     public static void main(String[] args) {
  24.         final LizardClass joe = new LizardClass("Joe", (float) 100.5);
  25.         System.out.println(joe.getName() + "'s weight is " + joe.getWeight());
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement