• Interfaces is place or signature holder  a group of related behaviors that can belong to any class or struct. It is an effort to keep similar objects together.
    • Example
       interface team1
      {
      void MyFunction(string str);//this is a method
      }
  • Interfaces may contain methods, properties, events, indexers, or any combination of those four member types.
  •  An interface can not contain fields.

 

import java.io.*;
import java.util.*;//to use EnumSet, EnumMap classes
public class Test_This {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String str ="";
Process pp = new Process();
try{
System.out.print("Please write your name: ");
str = br.readLine();
System.out.println(pp.Myfunction_1(str));
System.out.println(pp.Myfunction_2(str));

}//try
catch(NumberFormatException e)
{ System.out.println("data was blank");}
}
}
class Process
{
public Process() { System.out.println("Process outer constructor");}
int n1=10, n2 =8;
//processing string and returns to the caller
public String Myfunction_1(String str)
{
System.out.println("method_1 :");
return ("Judge 1 awards " + str + " points :" + n1);
}//end method_1
public String Myfunction_2(String str)
{
System.out.println("method_2 :");
return ("Judge 2 awards " + str + " points :" + n2);
}//end method_2
}//end of class process
interface team1
{
String MyFunction_1(String str);
}
interface team2
{
String MyFunction_2(String str);
}