Java inherits multiple interfaces

Source: Internet
Author: User

#

 Package edu. javase. buffer;

Interface Faces {
Public Void Facefun1 ();

Public Int Facefun2 ();

Public String facefun3 ();
}

Interface Faces2 {
Public Void Facefun11 ();

Public Int Facefun22 ();

Public String facefun33 ();
}

Class Fatherz {
Public Fatherz (){
System.
Out . Println ( " Fatherz Constructor " );
}

Public Fatherz ( Int I ){
System.
Out . Println ( " Fatherz int I Constructor " + I );
}

Public Void Fatherfun (){
System.
Out . Println ( " Fatherfun " );
}

}

Class Demoface extends fatherz implements faces, faces2 { // All interfaces must be implemented once integrated
Public Demoface (){
Super ();
System.
Out . Println ( " Demoface Constructor " );
}

Public Demoface ( Int I ){
Super (
1 );
System.
Out . Println ( " Demoface int I Constructor " + I );
}

@ Override
Public Void Facefun1 (){
System.
Out . Println ( " Facefun1 " );
}

@ Override
Public Int Facefun2 (){
System.
Out . Println ( " Facefun2 " );
Return 0 ;
}

@ Override
Public String facefun3 (){
System.
Out . Println ( " Facefun3 " );
Return Null ;
}

@ Override
Public Void Facefun11 (){
System.
Out . Println ( " Facefun11 " );
}

@ Override
Public Int Facefun22 (){
System.
Out . Println ( " Facefun22 " );
Return 0 ;
}

@ Override
Public String facefun33 (){
System.
Out . Println ( " Facefun33 " );
Return Null ;
}
}

Public Class Demointerface {
Public Static Void Main (string [] ARGs ){
Demoface dd
= New Demoface ();
Dd. facefun1 ();
// Call the interface and implement
Dd. facefun2 ();
Dd. facefun3 ();

Dd. facefun11 ();
Dd. facefun22 ();
Dd. facefun33 ();
System.
Out . Println ( " ---------------- " );

Demoface FF
= New Demoface ( 5 );
Ff. fatherfun ();
// Inherit from father
}
}

#

#
#
#

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.