Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.spec;
- import com.spec.model.Callback;
- import com.spec.model.Client;
- import com.spec.model.SpecialClient;
- import com.spec.model.Student;
- /**
- *
- * @author Admin
- */
- public class Main {
- public static void makeCall(Callback c){
- //
- c.callback(10);
- }
- public static void main(String[] args) {
- Callback c = null;
- // ошибка - нельзя создать объект (экземпляр) на основе интерфейса!!!
- //Callback c1 = new Callback();
- Callback c1 = new Client();
- System.out.println("Callback.S1=" + Callback.S1);
- //Callback.S1 = 5;
- //
- makeCall(c1);
- makeCall(new SpecialClient());
- // ошибка - нельзя создать объект (экземпляр) на основе абстракного класса!!!
- //AbstractClient ac = new AbstractClient();
- //
- Student s = new Student("Nick", 10);
- System.out.println("s.toString=" + s.toString());
- //
- Object o = new Student("Serg", 20);
- System.out.println("o.toString()=" + o.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement