Java Abstract Interface

Source: Internet
Author: User
Package edu. javase. buffer;

Abstract Class ABS {
Abstract Void Fun1 (); // Abstract Method

Abstract Void Fun2 ();

Public Void Method (){
System.
Out . Println ( " In abstract using " );
}

Public Void Method2 (){
System.
Out . Println ( " Class ABS method2... " );
}
}

Interface Face1 {
Public Void Facefun1 ();
}

Interface Face2 {
Public Void Facefun2 ();
}

Public Class Abstractdemo extends ABS implements face1, face2 {
Public Static Void Main (string [] ARGs ){
Abstractdemo
= New Abstractdemo ();
A. fun1 ();
// Abstract implementation
A. facefun1 (); // Interface implementation

A. Method ();
// Abstract Implementation Method
A. method2 (); // Abstract Implementation Method
}

// Override abstract Implementation Method
Public Void Method2 (){
System.
Out . Println ( " Class abstractdemo method2... " );
}

// Abstract methods must be implemented
@ Override
Void Fun1 (){
System.
Out . Println ( " Fun1 " );

}

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

// Interface methods must be implemented
@ Override
Public Void Facefun1 (){
System.
Out . Println ( " Facefun1 " );

}

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

}
/*
* Output:
Fun1
Facefun1
In abstract using
Class ABS method2...
*/// :~

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.