package com.sudhirtheindian2.java123;
import java.time.temporal.ChronoUnit;
interface vehical{
String name = "honda"; // public+static+final
int speed = 100;
void start();
void stop();
}
public class MyCustomer implements vehical {
@Override
public void start(){
System.out.println("for start the vehical , insert the key & press the start button"+name);
}
@Override
public void stop() {
System.out.println("for stop the vehical exit the key");
}
public static void main(String[] args) {
// What is interface in java ?
// 1 interface just like a class,
// 2 to achieve interface in java by the help
// of implements interface keyword
// Notes about interface
// 1 by default variable are public +static+final inside a interface
// 2 by default methods are public and abstract
// 3 from jdk 1.8 version interface can have default of static method
MyCustomer m = new MyCustomer();
m.start();
m.stop();
System.out.println(name);
}
}
Computer Storage Units Converter Computer Storage Units Converter From: Bytes Kilobytes Megabytes Gigabytes Terabytes Value: To: Bytes Kilobytes Megabytes Gigabytes Terabytes Convert
टिप्पणियाँ
एक टिप्पणी भेजें