Java learning memo (basic)

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

    1. What can be included in the class declaration ・ Method ·field -Constructor (function executed at the same time as declaring a class with new)

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*;  Public class Sample{  }

  1. import declaration Only classes in the same package as the Java.lang package can omit the import declaration.  ↓ Basic classes (String, System, etc.)

The "" asterisk refers to all classes that belong to that package. Example)  Import java.util.;

  1. Inheritance Example)  Public class Sample{  protected int num = 10;  }

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

  1. Entry point When there are multiple methods in a class, the method to start processing is called an entry point. The description method in Java has been decided. Description) Public static void main (String [] argument name) {  } ・ Being open to the public -Can be executed without creating an instance statically (call with new synonym for object) -The return value cannot be returned (void) -The method name must be main -The argument should receive one String array type  ↓ The String type with variable length arguments is also OK because it will be converted to an array type when compiling. Description) Public static void main (String ... argument name) {  }

Recommended Posts

Java learning memo (basic)
java basic knowledge memo
Java learning memo (method)
Java learning memo (interface)
Java learning memo (inheritance)
Java learning (0)
Java basic learning content 7 (exception)
Java basic learning content 5 (modifier)
Java memo
Java learning memo (logical operator)
Java learning memo (abstract class)
Java Basic Learning Content 8 (Java API)
Java basic learning content 4 (repetition)
Java learning memo (creating an array)
Java basic learning content 9 (lambda expression)
Java learning memo (while statement, do-while statement)
Java basic learning content 2 (array / ArrayList)
java anything memo
Java Silver memo
Java learning day 5
java, maven memo
Java basic grammar
Java basic grammar
Java basic knowledge 1
Java SE 7 memo
[Java] [Basic] Glossary
java anything memo 2
Java basic grammar
Java basic grammar
Java exercises [Basic]
Java specification memo
java learning day 2
Java pattern memo
java learning day 1
(Learning memo) Java Level 2 measures: Question range
Java basic learning content 1 (literals, variables, constants)
Java Basic Learning Content 6 (Inheritance / Abstract Class / Interface)
Java development environment memo
Ruby learning points (basic)
java learning (conditional expression)
Java Kuche Day memo
[Java] Data type ①-Basic type
ruby basic syntax memo
[Java ~ Method ~] Study memo (5)
Learning memo 01 (forward / redirect)
JAVA learning history interface
java lambda expression memo
(Memo) Java for statement
Java lambda expression [memo]
[Java] Implicit inheritance memo
java competitive programming memo
[Java] Basic method notes
[Memo] Java Linked List
Java basic data types
Basic Java OOps concepts
Learning memo when learning Java for the first time (personal learning memo)
Learning Java framework # 1 (Mac version)
Java (WebSphere Application Server) memo [1]
Java memo (standard class) substring
Java basic syntax + α trap
JAVA learning history interface inheritance