`

about abstract class

 
阅读更多

yes, we do know abstract class cannot be instantiated, if it's extended, its constructor is not allowed to be private, that's because its derivative wants to use its super constructor which also means it'll be called associated with its derivative instantiation. let's see the following example:

 

abstract class Father {
    protected Father() {
        System.out.println("Father");
    }
}

public class Test extends Father {

    private Test() {
        System.out.println("Test");
    }

    public static void main(String[] args) {
        new Test();
    }
}

 

its output is supposed to be:

Father

Test

 

分享到:
评论

相关推荐

    java实验7.2(Auto.java Ford.java)

    Finally, write a program that uses the Auto class and subclasses to display information about different cars. The java programs should be named like: Auto.java Ford.java Chevy.java UseAuto.java ...

    Java 英文习题及答案

    2. Which of the following statements is (are) true about any abstract method in Java? I. It contains no definition. Ⅱ. It cannot be declared public. (a) I and II (b) I only (c) None (d) II only 3....

    lucene-analyzers-common-5.1.0.jar

    * Class SnowballProgram is made abstract and contains new abstract method stem() to avoid reflection in Lucene filter class SnowballFilter. * All use of StringBuffers has been refactored to ...

    java实验7.1(CollegeCourse.java)

    Create an abstract Auto class with fields for the car make and price. Include get and set methods for these fields; the setPrice() method is abstract. Create two suclasses for individual automobile ...

    servlet2.4doc

    Notification that the servlet context is about to be shut down. contextInitialized(ServletContextEvent) - Method in interface javax.servlet.ServletContextListener Notification that the web ...

    JSP Simple Examples

    Unlike interface the abstract class may implement some of the methods defined in the class, but in this class at least one method should be abstract. Using Super class Variables With Sub-classed ...

    Programming in Objective-C 4th Edition

    Abstract Classes 173 Exercises 174 9 Polymorphism, Dynamic Typing, and Dynamic Binding 177 Polymorphism: Same Name, Different Class 177 Dynamic Binding and the id Type 180 Compile Time Versus Runtime ...

    Head First Go 1st Edition

    This book, rather than talking about the features of Go in abstract terms, features simple, clear examples that demonstrate Go in action, and diagrams to explain difficult concepts. This book will ...

    NETCFSERUP

    <remarks>The API class provides the capability of "reflecting" through objects to gain information at runtime about their properties. This capability provides an excellent way for application ...

    Pango Reference Manual

    Glyph Storage - Structures for storing information about glyphs Fonts - Structures representing abstract fonts Text Attributes - Font and other attributes for annotating text Tab Stops - Structures...

    21天学通java (英文版)

    7 More About Methods 111 Week 2 at a Glance Day 8 Java Applet Basics 129 9 Graphics, Fonts, and Color 149 10 Simple Animation and Threads 173 11 More Animation, Images, and Sound 195 12 Managing ...

    PHP Objects, Patterns, and Practice(Apress,2016)

    Master advanced object-oriented features, including static methods and properties, managing error conditions with exceptions, and creating abstract classes and interfaces. Learn about the new object-...

    Professional.Python.1119070856

    Python offers many tools and techniques for writing better code, but often confusing documentation leaves many programmers in the dark about how to use them. This book shines a light on these ...

    Principles.of.Data.Science

    With this book, you'll feel confident about asking―and answering―complex and sophisticated questions of your data to move from abstract and raw statistics to actionable ideas. With a unique ...

    Beginning Microsoft Visual CSharp 2008 Wiley Publishing(english)

    Interfaces Versus Abstract Classes 270 Struct Types 272 Summary 275 Exercises 276 Chapter 10: Defining Class Members 278 Member Definitions 278 Additional Class Member Topics 291 ...

    stdafx.h代码

    class CResourceException;// Win resource failure exception class CUserException; // Message Box alert and stop operation class CGdiObject; // CDC drawing tool class CPen; // a pen / HPEN wrapper...

    Exploring Java.pdf

    Exploring Java introduces the basics of Java, the hot new object-oriented programming language for networked applications from Sun ...Using the Abstract Windowing Toolkit (AWT) Writing a security manager

    Bezier曲线类的构造

    and a discussion about the opt imality of SDEOQ model w ith both it s part ial and whole opt imal solut ions being achieved. Key words: economic order quant ity( EOQ) , permissble shortage, quant ity ...

    Scala for the Impatient 2nd (完整英文第二版 带书签)

    1.5 More about Calling Methods 8 1.6 The apply Method 9 1.7 Scaladoc 10 Exercises 15 2 CONTROL STRUCTURES AND FUNCTIONS A1 17 2.1 Conditional Expressions 18 2.2 Statement Termination 19 2.3 Block ...

    Inference of Gene Relations from Microarray

    Abstract. We describe an application of Abductive Logic Programming (ALP) to the analysis of an important class of DNA microarray experiments. We develop an ALP theory that provides a simple and ...

Global site tag (gtag.js) - Google Analytics