interface
The term "Interface" indicates a common set of methods, which may interact with an object by the set of methods.
java Interface (interface) is a set of constants and abstract methods set. Abstract no physical method is a method, and abstract method comprises not only the code after the parameter list of a method The header is followed by only a semicolon. Interfaces can not be instantiated.
Complexity interface consists of the following two abstract methods: setComplexity and getComplexity
public interface Complexity { public viod setComplexity(int complexity); public int getComplexity(); }
public interface Complexity { public static void main (String [] args) { Final a float the PI = 3.14159f; // define a constant ratio of the circumference representing the PI a float getArea ( a float R & lt); // define a method for calculating the area getArea () a float getCircumference ( a float R & lt); // define a method for calculating the perimeter getCircumference () } } public class Question the implements Complexity { Private String Question, answer; public a float the getArea ( a float R & lt) { A float Area = the PI * R & lt * R & lt; // calculated and assigned to the variable circular area Area return Area; // round returns the calculated area after } public a float the getCircumference ( a float R & lt) { a float Circumference the PI * = 2 * R & lt; / / calculated and assigned to the variable circumference circumference return circumference; // circumference of the return calculation } public static void main (String [] args) { Question C = new new Question (); a float f = c.getArea(2.0f); System.out.println(Float.toString(f)); } }