Type safe Enum
β Why do we need Enum? Limit field to certain value User role can be only BASIC, GOLD, DIAMOND ππ» how can we prevent entering basiiiic(μ€ν) or diamond(μλ¬Έμ) or VIP(μ‘΄μ¬νμ§ μλ κ°)? π ENU...
β Why do we need Enum? Limit field to certain value User role can be only BASIC, GOLD, DIAMOND ππ» how can we prevent entering basiiiic(μ€ν) or diamond(μλ¬Έμ) or VIP(μ‘΄μ¬νμ§ μλ κ°)? π ENU...
β Class ν΄λμ€ Class ν΄λμ€λ₯Ό ν΅ν΄μ get metadata about a class ν μ μλ€ βοΈ get class type information: class name, super class, interface, access modifierβ¦ βοΈ reflection: get field, method, co...
β String is reference String is reference value can create String as literal or as instance String str1= "hello"; //literal String str2 = new String("hello"); //instance π° two code is...
β Summary Immutable: cannot change reference value 1οΈβ£ final field, 2οΈβ£ no setter β Primitive π Reference π Primitive int a = 10; int b = a; b = 20; β μ΄μ aμ κ°μ? μ¬μ ν 10 β μ΄μ bμ...
β Object class Object class is parent of all Java classes highest parent of all Java class μλ°μ μ΅μμ λΆλͺ¨ ν΄λμ€ implicitly imports object public class Parent extends Object (extends Obje...
β OCP Open for extension: new code should be able to be extended νμ₯μλ μ΄λ €μκ³ Closed for modification: old code must not be modified λ³κ²½μλ λ«νμμ΄μΌ νλ€ β How t...
β Summary interface is like pure abstract class cannot create instance MUST be overrided by child class implements can implements several interface β Interface ...
β Abstract class Parent class, but can NOT be created as instance λλ¬Όμ΄λΌλ κ°λ μμ κ°μμ§, κ³ μμ΄ λ±μ΄ μμ§λ§ "λλ¬Ό"μ΄λΌκ³ νλ λλ¬Όμ μμ λ°λΌμ λλ¬Όμ μΈμ€ν΄μ€λ₯Ό μμ±νλ©΄ μ λ¨ Animal class: abstract class Dog class, Ca...
βοΈ extends βοΈ method overriding β Polymorphism: parent can become child parent class child class extends parent class 1οΈβ£ Polymorphism: parent CAN become child instance child CAN N...
β Final final: can not change after initialization final value can not be altered after initializatoin μ²μ κ° ν λΉ νμλ λ³μμ κ°μ λ³κ²½νμ§ λͺ»νκ² λ§μλ²λ¦°λ€ ππ» without final int data0; data0 = 10; ...