Studied more about interface_20260526

JAEWOONG LEE·2026년 5월 26일
post-thumbnail

I did about under parts.
It's just testing for myself and I found out what I do not get it

Only using main, I should make other source,
Let's get practice implements part and methodes

package oop4practice.eg09testMyself;

interface All_Cellphonetype
{
void Battery();
}

(publicX)class Samsung implements All_Cellphonetype
{
public void Battery()
{
System.out.println("삼성 배터리 완료");
}

}

class LG implements All_Cellphonetype
{
public void Battery()
{
System.out.println("엘지 배터리 완료");
}

}

class BaterryCharge
{

All_Cellphonetype cellphonetype;
BaterryCharge(All_Cellphonetype cellphonetype)
{
    this.cellphonetype = cellphonetype;
}

void BaterryCharged()
{
    System.out.println("충전 시도중입니다..");

    cellphonetype.Battery();
}

}

public class Main
{
public static void main(String[] args)
{
String sBatteryType = "Samsung";
All_Cellphonetype all_Cellphonetype;

    all_Cellphonetype = new Samsung();

    BaterryCharge baterryCharge = new BaterryCharge(all_Cellphonetype);
    baterryCharge.BaterryCharged();
}

}

profile
just for programming test

0개의 댓글