Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. enum color { RED, GREEN, BLUE };
  2.  
  3. public class Dog{
  4. String breed;
  5. int age;
  6. String color;
  7.  
  8. void barking(){
  9. //code here
  10. }
  11.  
  12. void hungry(){
  13. //code here
  14. }
  15.  
  16. void sleeping(){
  17. //code here
  18. }
  19. }
  20.  
  21. Dog fluffy = new Dog();
  22.  
  23. fluffy.breed = "ovcharka";
  24. fluffy.age = 10;
  25. fluffy.color = "searij";
  26.  
  27. fluffy.barking();
  28. fluffy.hungry();
  29. fluffy.sleeping();
  30.  
  31. class Dog{
  32. public Dog(String breed, int age, String color) { //это контсруктор
  33. this.breed = breed;
  34. this.age = age;
  35. this.color = color;
  36. }
  37. String breed;
  38. int age;
  39. String color;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement