[Java] [Java Bronze] Learning memo (interface, static method, type conversion, etc.)

1 minute read

A summary of common mistakes in learning Java Bronze.


-Field is a constant only All fields are implicitly qualified with final static. (The qualifier can be omitted) You can modify fields with static (* The value defined by static can be executed without creating an instance)

・All methods are implicitly qualified with public abstract You cannot qualify a method with static. (* static methods can be executed without creating an instance, so abstract methods cannot be modified)

static method

Static method cannot access instance field defined in own class. → Compile error occurred!

Static methods can be executed without creating an instance. A compile error occurs in order to prevent accessing instance field from static method before creating instance.


Assign an instance of the parent class to the type of the child class. By using the cast operator, forced type conversion is possible.

No compile error occurs. However!

Exception occurs at the moment of actually assigning (ClassCastException)


Substitute an instance of the child class with the type of the parent class.

If you execute a method that is in the parent class but not in the child class, Compile error will occur.


・Method name ・Number of arguments

  • Argument type ・Order of arguments


Initial value of variable

Variables are initialized with a default value when they are created.

・Byte type 0 ・Short type 0 ・Int type 0 ・Long type 0L ・Float type 0.0f ・Double type 0.0d ・Char type’\u0000’ ・Boolean type false ・Reference type null