package ja_0719; interface Mbc{ void play(); } class kbs{ void autoPlay(Mbc a) { a.play(); } } class MySbs implements Mbc{ @Override public void play() { System.out.println("Mysbs TV 생방송"); } } class MyCNN implements Mbc { @Override public void play() { System.out.println("Mysbs TV 야구 생중계"); } } public class InterfaceTest_3 { public static void main(String[] args) { kbs obj = new kbs(); obj.auto..

13일차인 오늘은 오버라이딩, 접근지정자, Final, 객체 형변환에 대해서 학습했다. (1) 오버라이딩 package ja_0718; class AA_2{ int aa = 55; int bb = 77; void display() { System.out.println("AA_2 클래스의 display() 메소드"); } } class BB_2 extends AA_2{ int bb = 478; int cc = 888; void display() { System.out.println("BB_2 클래스의 display() @@@ 메소드"); } } public class Overriding_1 { public static void main(String[] args) { //AA_2 obj_1 = new AA_..

오늘은 오버로딩, 오버라이딩, 상속에 대해서 학습했다. (1) 오버로딩 : 여러 메소드가 같은 이름을 가지고 있지만, 인자의 수나 자료형이 다른 것을 말한다. class Info2{ private String name; private int age; private char sex; private String tel; //생성자 Overloading //두 메서드가 같은 이름을 가지고 있으나 인자의 수나 자료형이 다른 경우를 말한다. public Info2(String n, int a, char s, String t) { name = n; age = a; sex = s; tel = t; } public Info2(String n, int a) { //생성자 name = n; age = a; sex = 'm..

11일차인 오늘은 접근 지정자(Access Modifier),클래스,메소드에 대해서 집중 학습했다. (1) 클래스 package ja_0714; class Car{ //filed int door; String color; String gearType; String direction; public Car() { //default 생성자 } public Car(String c,String g,int d,String dd) { //매개변수가 있는 생성자 color = c; gearType = g; door = d; direction = dd; } public String toString() { return "color : " + color + ", gearType : " +gearType + " door : ..

10일차인 오늘은 가변배열, 매개변수, 생성자에 대해서 공부했다. (1) 가변배열 public class Array_10 { public static void main(String[] args) { int[][] var = new int[3][]; // 가변배열 뒤쪽 마지막 값만 비워둘 수 있다 int i, j, k = 0; var[0] = new int[3]; var[1] = new int[2]; var[2] = new int[4]; // 초기값 입력 for(i = 0; i < var.length; i++) { for(j = 0; j < var[i].length; j++) { var[i][j] = k++; } } for(i = 0; i < var.length; i++) { for(j = 0; j < v..

오늘은 Eclipse로 Tool을 바꾸고 배열에 대해서 집중적으로 학습하기 시작했다. 1차원 배열과, 2차원 배열에 대해서 학습했고, 학습한 배열의 개념을 통해서 로또번호를 추출하는것으로 마무리했다. 1) 1차원 배열 선언법 int[] 변수명 = new int[배열크기]; public class Array_1 { public static void main(String[] args) { int[] month = new int[12]; // 배열 객체 생성 month[0] = 31; month[1] = 31; month[2] = 31; month[3] = 31; month[4] = 31; month[5] = 31; month[6] = 31; month[7] = 31; month[8] = 31; month[9..

새로운 한주를 시작하면서, 8일차 Start! 오늘은 For, While, DoWhile, Return, break, Continue문에 대해서 공부하고 관련 예제들을 학습했다. 오늘 선생님께서 제시해주신 여러 문제가 생각보다 어렵고 풀리지 않았다. 반복, 반복, 반복많이 살길이라고 계속 강조하는거보니 정말로 열심히 반복해야겠다. class While_1 { public static void main(String[] args) { int cnt = 0; int sum = 0; int even = 0; int odd = 0; // int even = 0, odd = 0; while(cnt < 100) { cnt ++; if (cnt % 2 == 0) { even += cnt; } else { odd += ..