Skip to content

Instantly share code, notes, and snippets.

@youngjinmo
Last active January 14, 2021 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youngjinmo/15320152f54107007b03726162d34b06 to your computer and use it in GitHub Desktop.
Save youngjinmo/15320152f54107007b03726162d34b06 to your computer and use it in GitHub Desktop.
instance of 연산자 실습 코드 (livestudy 3주차)
public class Example01{
Integer num = 20;
}
public class Example02 extends Example01 {
String greeting = "Hello";
}
public class StudyHalle03 {
public static void main(String[] args) {
Arithmetic arithmetic = new Arithmetic();
Example01 ex01 = new Example01();
Example02 ex02 = new Example02();
System.out.println((arithmetic instanceof Arithmetic)+"\n");
System.out.println(ex01.num instanceof Integer);
System.out.println(ex02.greeting instanceof String);
System.out.println((ex01.num instanceof Object)+"\n");
System.out.println(ex02 instanceof Example01);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment