Code:
SamsungElectronics.java
package InterfaceDemo;
/**
*
* @author Ankit
*/
public interface SamsungElectronics {
void play();
void stop();
void pause();
}
/**
*
* @author Ankit
*/
public interface SamsungElectronics {
void play();
void stop();
void pause();
}
SamsungLEDTv.java
package InterfaceDemo;
/**
*
* @author Ankit
*/
public class SamsungLEDTv implements SamsungElectronics{
@Override
public void play() {
System.out.println("LED TV is playing now");
}
@Override
public void stop() {
System.out.println("LED Tv has Stopped now");
}
@Override
public void pause() {
System.out.println("LED Tv has paused now");
}
}
/**
*
* @author Ankit
*/
public class SamsungLEDTv implements SamsungElectronics{
@Override
public void play() {
System.out.println("LED TV is playing now");
}
@Override
public void stop() {
System.out.println("LED Tv has Stopped now");
}
@Override
public void pause() {
System.out.println("LED Tv has paused now");
}
}
SamsungLCDTv.java
package InterfaceDemo;
/**
*
* @author Ankit
*/
public class SamusungLCDTv implements SamsungElectronics{
@Override
public void play() {
System.out.println("LCD Tv is playing now");
}
@Override
public void stop() {
System.out.println("LCD Tv is stopped now.");
}
@Override
public void pause() {
System.out.println("LCD Tv is paused now");
}
}
/**
*
* @author Ankit
*/
public class SamusungLCDTv implements SamsungElectronics{
@Override
public void play() {
System.out.println("LCD Tv is playing now");
}
@Override
public void stop() {
System.out.println("LCD Tv is stopped now.");
}
@Override
public void pause() {
System.out.println("LCD Tv is paused now");
}
}
MainSamsung.java
package InterfaceDemo;
/**
*
* @author Ankit
*/
public class MainSamsung {
public static void main(String[] args) {
SamsungLEDTv s1 = new SamsungLEDTv();
s1.play();
s1.pause();
s1.stop();
SamusungLCDTv s2 = new SamusungLCDTv();
s2.play();
s2.pause();
s2.stop();
}
}
/**
*
* @author Ankit
*/
public class MainSamsung {
public static void main(String[] args) {
SamsungLEDTv s1 = new SamsungLEDTv();
s1.play();
s1.pause();
s1.stop();
SamusungLCDTv s2 = new SamusungLCDTv();
s2.play();
s2.pause();
s2.stop();
}
}
No comments:
Post a Comment