Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.ww.lesson1;
- import java.util.Scanner;
- public class Main04 {
- public static void main(String[] args) {
- new Main04().run(args);
- }
- public void run(String[] args) {
- System.out.println("Hello");
- // duck = Duck()
- Duck duck = new Duck();
- duck.quack();
- }
- // inner class
- public class Leg {
- public Leg() {
- super();
- }
- void go() {
- System.out.println("going....");
- }
- }
- public class IronLeg extends Leg {
- public IronLeg() {
- super();
- }
- void go() {
- }
- }
- public class Animal {
- Integer weight;
- public Animal(Integer weight) {
- super();
- this.weight = weight;
- }
- public void do_nothing() {
- }
- }
- public interface FlyingAnimal {
- void flying();
- }
- public class Duck extends Animal implements FlyingAnimal {
- public Duck() {
- // has to be the first
- super(2);
- // super.weight = 0;
- }
- void quack() {
- System.out.println("qua");
- }
- @Override
- public void flying() {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement