220424
/*
import java.util.*;
abstract class Shape {
private Shape next;
public Shape() { next = null ;}
public void setNext(Shape obj) { next = obj; } // 링크 연결
public Shape getNext() { return next; }
public abstract void draw(); // 추상 메소드
}
class Line extends Shape {
public void draw() {
System.out.println("Line(선)");
}
}
class Rect extends Shape {
public void draw() {
System.out.println("Rectangle(직사각형)");
}
}
class Circle extends Shape {
public void draw() {
System.out.println("Circle(원)");
}
}
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("그래픽 에디터 Beauty 3.0을(를) 실행합니다.");
Shape s= new Line();
while(true) {
System.out.println("삽입은 1번, 삭제는 2번, 모두보기는 3번, 프로그램을 종료하려면 0번을 눌러주십시오.");
int maininput = sc.nextInt();
Shape s1=s;
if(maininput == 1) {
while(s1.getNext()!=null){
s1=s1.getNext();
}
System.out.println("Line(줄)은(는) 1번, Rect(직사각형)은(는) 2번, Circle(원)은(는) 3번을 눌러주십시오.");
int shapeinput = sc.nextInt();
if(shapeinput == 1) {
s1.setNext(new Line());
}
else if(shapeinput == 2){
s1.setNext(new Rect());
}
else if(shapeinput == 3){
s1.setNext(new Circle());
}
else{
System.out.println("오류로 Beauty 3.0을 종료합니다!!");
return ;
}
}
else if(maininput == 2) {
}
else if(maininput == 3) {
while(true){
s1=s1.getNext();
if(s1==null) break;
s1.draw();
}
}
else if(maininput == 0) {
System.out.println("0번을 입력하셨습니다. \n프로세스 차단으로 인해 Beauty 3.0을 종료합니다");
return ;
}
}
}
}
*/
interface PhoneInterface {
final int TIMEOUT = 1000000;
void seanCall();
void resivecall();
default void printLogo() {
System.out.println("** Phone **");
System.out.println("무언가 웃기고 이상한 OS 4.0");
}
}
interface MobilePhoneInterface extends PhoneInterface {
void sendSMS();
void reciveSMS();
}
interface MP3Interface {
public void play();
public void stop();
}
class PDA{
public int calculate(int x, int y) {
return x + y;
}
}
class SmartPhone extends PDA implements MobilePhoneInterface, MP3Interface {
public void sendCall() {
System.out.println("따르릉 따르릉 입니다.");
}
public void recievecall() {
System.out.println("전화 이가 왔다.");
}
public void sendSMS() {
System.out.println("문자가 왔어요.");
}
public void play() {
System.out.println("음악 을를 연주합니다.");
}
public void stop() {
System.out.println("음악 을를 중단합니다.");
}
public void sch() {
System.out.println("일정 을를 관리합니다.");
}
}
public class Main {
public static void main(String[] args) {
SmartPhone phone = new SmartPhone();
phone.printLogo();
phone.sendCall();
phone.play();
System.out.println("3 더하귀 5는 " + phone.calculate(3, 5));
phone.sch();
}
}
C vs Java
C
Java
Python 3
C++



