본문 바로가기
  • 마침표 보다 쉼표를 나타내자
국비교육 [完]/빅데이터과정

12월 20일 - (28일차)

by Y코더 2022. 12. 20.
728x90

어느덧 12월달도 10일이 남았다.

 

자바 수업도 순조롭게 풀리는 것 같다.

조금 머리를 아프게 하는 문제가 있었다.

package ex_5_3;

class Person { }
class Student extends Person { }
class Researcher extends Person { }
class Professor extends Researcher{ }

public class InstanceOfEx {
	static void pr(Person s) {
		if(s instanceof Person)
			System.out.print("Person ");
		if(s instanceof Student)
			System.out.print("Student ");
		if(s instanceof  Researcher)
			System.out.print("Researcher ");
		if(s instanceof Professor)
			System.out.print("Protessor ");	
		System.out.println();
	}
	public static void main(String[] args) {
		System.out.print("new Student() ->\t");			pr(new Student());
		System.out.print("new Researcher() ->\t");		pr(new Researcher());
		System.out.print("new Protessor() ->\t");		pr(new Professor());
	}
}

단순히 많은 생각이 교차해서 생긴 일인 것 같다.

 

728x90

'국비교육 [完] > 빅데이터과정' 카테고리의 다른 글

12월 22일 - (30일차)  (0) 2022.12.22
12월 21일 - (29일차)  (0) 2022.12.21
12월 19일 - (27일차)  (0) 2022.12.19
12월 17일 - (26일차)  (0) 2022.12.17
12월 16일 - (25일차)  (0) 2022.12.16