Big Data Java Foundation Fifth day job

Source: Internet
Author: User

Tag:java   interface    class inherits    bastract   

The first question:     the static code block when the class is loaded, and the static code block acts in order to initialize the value. The second question:     constructs a block of code prior to the call to the constructor, regardless of the location of the method declaration. The order is: Load class  =>  execute static code block      =>  instantiate class  =>  execute construct block of code  = >  executes the constructor.      constructs blocks of code to initialize the values of object property members. The third question:     executes a static block of code, Class.forName ("Benz", Flase,benzdemo.class.getclassloader ()); fourth question: Class  Person{    .....   }class Man extends Person{    &NBSP, ...} CLASS WOMAN EXTENDS PERSON{   &NBSP, ...} Question Fifth:     The abstract method must be in an abstract class, the subclass of which inherits the abstract class must have member properties to overwrite (override) The member property of the abstract class.      cannot be instantiated by using the abstract keyword modifier.       abstract classes have constructors and cannot be overloaded. Question sixth:     abstract + final        abstract  + private Seventh:     super (); Accesses the constructor of the parent class.     this (); Accesses the constructor of the current class. Question eighth:    &NBSp;interface iwhite{        public string iwhite ();    }   interface IRich{         Public int irich ();    }   interface ibeauti{         public string ibeauti ();   &nbsp,} nineth question:   class  WomenStar implements IWhite,IRich,IBeauti{    public String  iwhite{        return  "White";       }      public int IRich{            return 100000000;       }        public String IBeauti{           return  "Beautiful";        }       public boolean  Tomarring (String white,int rich,string beauti) {            if (white == this. Iwhite ()  && rich >= this. Irich && beauti == this. Ibeauti ()) {               return  true;           }            return false;       }     the tenth question:    class earchricher{         Public static void main (String[] args) {            boolean result = marring ();            string str = result ?  "Success! " : " Failed! ";            system.out.println ();         }        public Boolean  Marring () {           womenstar w = new  womenstar ();            return w.tomarring ();         }    }


This article from "Do Not Tang donation" blog, please be sure to keep this source http://senlinmin.blog.51cto.com/6400386/1771120

Big Data Java Foundation Fifth day job

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.