Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- public class Birds {
- // features of Birds : color, size, name, weight;
- String color;
- double size;
- String name;
- double weight;
- // functions of Birds: Flying, Hopping, walking, breathing, eating, hovering;
- void Flying(){
- System.out.println("I can fly");
- }
- void Hopping(){
- System.out.println("I can hop");
- }
- void Walking(){
- System.out.println("I can walk");
- }
- void Breathing(){
- System.out.println("I can breath");
- }
- void Hovering(){
- System.out.println("I can hover");
- }
- void Eating(){
- System.out.println("I can eat");
- }
- public static void main(String[] args) {
- Birds eagle = new Birds();
- Birds parrot = new Birds();
- Birds hummingbird = new Birds();
- Birds flamingo = new Birds();
- eagle.name = "Golden Eagle";
- eagle.color = "black";
- eagle.size = 3.4;
- eagle.weight = 10;
- eagle.Flying();
- eagle.Walking();
- parrot.Eating();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement