Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum color { RED, GREEN, BLUE };
- public class Dog{
- String breed;
- int age;
- String color;
- void barking(){
- //code here
- }
- void hungry(){
- //code here
- }
- void sleeping(){
- //code here
- }
- }
- Dog fluffy = new Dog();
- fluffy.breed = "ovcharka";
- fluffy.age = 10;
- fluffy.color = "searij";
- fluffy.barking();
- fluffy.hungry();
- fluffy.sleeping();
- class Dog{
- public Dog(String breed, int age, String color) { //это контсруктор
- this.breed = breed;
- this.age = age;
- this.color = color;
- }
- String breed;
- int age;
- String color;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement