/*
import java.util.*;
class Player {
String name;
String word;
void set(String name)
{
this.name = name;
}
String Getname() {
return name;
}
}
class Game {
Scanner sc = new Scanner(System.in);
void run(int num) {
Player[] p = new Player[num];
for (int i = 0; i < p.length; i++)
{
p[i] = new Player();
}
for (int i = 0; i < num; i++)
{
System.out.println("참가자의 이름 입력>>");
String name = sc.next();
p[i].set(name);
}
System.out.println("시작 단어는 아버지 입니다.");
int k=0;
String before="아버지";
while (true) {
for(int i=0;i<num;i++)
{
System.out.println(p[i].Getname() + ">>");
String after = sc.next();
if(before.charAt(before.length()-1)!=after.charAt(0)) {
System.out.println(p[i].Getname()+"의 패배");
return ;
}
before=after;
}
}
}
}
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("끝말잇기 게임을 시작합니다...");
System.out.println("게임에 참가하는 인원은 몇명입니까?>>");
int num = sc.nextInt();
Game g = new Game();
g.run(num);
}
}
*/
/*
import java.util.*;
class Point{
private int x,y;
// public Point() {
// System.out.println("Point의 생성자가 실행되었습니다.");
// }
public Point(int x, int y) {
this.x=x;
this.y=y;
}
void set(int x, int y) {
this.x=x;
this.y=y;
}
void showPoint() {
System.out.println("("+x+","+y+")");
}
}
class ColorPoint extends Point{
private String color;
public ColorPoint(int x, int y) {
//super(x,y);
System.out.println("ColorPoint의 생성자 실행 ");
}
void setColor(String color) {
this.color=color;
}
void showColorPoint() {
System.out.print(color);
showPoint();
}
}
class Main{
public static void main(String[] args) {
ColorPoint cp=new ColorPoint(2,2);
cp.set(3, 4);
cp.setColor("red");
cp.showColorPoint();
}
}
*/
/*
import java.util.*;
class Point{
private int x,y;
public Point() {
this.x=this.y=0;
}
public Point(int x,int y)
{
this.x=x;
this.y=y;
}
public void showPoint() {
System.out.println("("+x+","+y+")");
}
}
class ColorPoint extends Point{
private String color;
public ColorPoint(int x,int y ,String color) {
super(x,y);
this.color=color;
}
public void showColorPoint() {
System.out.print(color);
showPoint();
}
}
public class Main{
public static void main(String[] args) {
ColorPoint cp= new ColorPoint(5,6,"blue");
cp.showColorPoint();
}
}
*/
/*
import java.util.*;
class Shape{
public Shape next;
public Shape() {
next=null;
}
public void draw() {
System.out.println("Shape");
}
}
class Line extends Shape{
public void draw() {
System.out.println("Line");
}
}
class Rect extends Shape{
public void draw() {
System.out.println("Rect");
}
}
class Circle extends Shape{
public void draw() {
System.out.println("Circle");
}
}
public class Main{
static void paint(Shape p) {
p.draw();
}
public static void main(String[] args) {
Line line=new Line();
paint(line);
paint(new Shape());
paint(new Line());
paint(new Rect());
paint(new Circle());
}
}
*/
/*
import java.util.*;
class Weapon{
protected int fire() {
return 1;
}
}
class Cannon extends Weapon{
protected int fire()
{
return 10;
}
}
public class Main{
public static void main(String[] args) {
Weapon weapon;
weapon=new Weapon();
System.out.println("기본 무기의 살상 능력은 "+weapon.fire());
weapon=new Cannon();
System.out.println("대포의 살상 능력은 "+weapon.fire());
}
}
*/
/*
import java.util.*;
abstract class Calculator{
public abstract int add(int a, int b);
public abstract int subtract(int a,int b);
public abstract double average(int[] a);
}
public class Main extends Calculator{
public int add(int a, int b) {
return a+b;
}
public int subtract(int a, int b) {
return a-b;
}
public double average(int[] a) {
double sum=0;
for(int i=0;i<a.length;i++)
sum+=a[i];
return sum/a.length;
}
public static void main(String[] args) {
Main c= new Main();
System.out.println(c.add(2, 3));
System.out.println(c.subtract(2, 3));
System.out.println(c.average(new int [] {2,3,4}));
}
}
오버로딩 vs 오버라이딩
같이 덮어쓰기(overwrite)
*/
/*
class Person{
void speak() {
System.out.println("im person....");
}
}
class Student extends Person{
void speak(int n) {
System.out.println(n+"iiii");
}
void speak() { //부모의 메소드 재정의
System.out.println("im student");
}
}
class Main{
public static void main(String[] args) {
Student s = new Student();
s.speak();
}
}
*/
/*
import java.util.*;
interface PhoneInterface{
final int TIMEOUT=10000;
void sendcall();
void receiveCall();
default void printLogo() {
System.out.println("** Phone **");
}
}
class SamsungPhone implements PhoneInterface{
@Override
public void sendcall() {
// TODO Auto-generated method stub
System.out.println("띠링");
}
@Override
public void receiveCall() {
// TODO Auto-generated method stub
System.out.println("전화");
}
public void flash() {
System.out.println("전화불");
}
}
public class Main{
public static void main(String[] args) {
SamsungPhone phone=new SamsungPhone();
phone.printLogo();
phone.sendcall();
phone.receiveCall();
phone.flash();
}
}
*/
/*
interface PhoneInterface{
final int TIMEOUT=10000;
void sendCall();
void receiveCall();
default void printLogo() {
System.out.println("** Phone **");
}
}
interface MobilePhoneInterface extends PhoneInterface{
void sendSMS();
void receiveSMS();
}
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{
@Override
public void sendCall() {
// TODO Auto-generated method stub
System.out.println("따릉");
}
@Override
public void receiveCall() {
// TODO Auto-generated method stub
System.out.println("전화");
}
@Override
public void sendSMS() {
// TODO Auto-generated method stub
System.out.println("문자가");
}
@Override
public void receiveSMS() {
// TODO Auto-generated method stub
System.out.println("문자와");
}
@Override
public void play() {
// TODO Auto-generated method stub
System.out.println("음악연주");
}
@Override
public void stop() {
// TODO Auto-generated method stub
System.out.println("음악멈춤");
}
public void schedule() {
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.schedule();
}
}
*/
//
//import java.util.*;
//class TV{
// private int size;
// public TV(int size) {this.size=size;}
// protected int getSize() {
// return size;
// }
//}
//
//class ColorTV extends TV{
//
// int color;
// ColorTV(int size,int color){
// super(size);
// this.color=color;
// }
//
// void printProperty() {
// System.out.println(getSize()+"인치"+color+"컬러");
// }
//}
//
//class Main{
// public static void main(String[] args) {
// ColorTV myTV=new ColorTV(32,1024);
// myTV.printProperty();
// }
//}
import java.util.*;
class TV{
private int size;
public TV(int size) {this.size=size;}
protected int getSize() {
return size;
}
}
class ColorTV extends TV{
int color;
ColorTV(int size,int color){
super(size);
this.color=color;
}
void printProperty() {
System.out.println(getSize()+"인치"+color+"컬러");
}
}
class IPTV
class Main{
public static void main(String[] args) {
ColorTV myTV=new ColorTV(32,1024);
myTV.printProperty();
}
}