Since I started studying Java Silver, I will upload it as my memorandum. Since it is a rough memo, details are not described.
Chapter 1 Java Basics
2.3. package ・ Mechanism for grouping and separating classes and interfaces ・ Group by folder -Always belong to a package (unspecified items are treated as a group of "anonymous packages" → only the same anonymous packages can be accessed) -Package name "package 1st layer folder name. 2nd layer folder name. 3rd layer folder name;" -Describe to the first line of the source code
Example) Package aaa; Import java.io.*; Public class Sample{ }
The "" asterisk refers to all classes that belong to that package. Example) Import java.util.;
If you want to inherit the above Sample class and use variables, public (modifier) class Derived class name extends Base class name {} to inherit. The class name that the base class name wants to use.
Same class, same package, other packages, different subclasses Public ○ ○ ○ ○ private ○ ☓ ☓ ☓ protected ○ ○ ☓ ○ None ○ ○ ○ ○ ○ ☓ ☓ ☓
6.7. Static import -Static = class variables and class declarations Description) Class name.Variable name Must be described every time as class name.method name. ↓ Import static ~. Class name. Variable name Import static ~. Class name. Method name By importing above, you only need to describe the variable name and method name after that. Even if there are multiple overloaded methods with the same name, it is judged by the type and type of the argument, so only one import description is OK.
・ Class declaration Declare fields and methods. → Called a member.
·override Subclass methods work instead of superclass methods with the same name
Recommended Posts