Java basic learning content 5 (modifier)

static modifier

Modifiers that can be attached to variables and methods. It can be called without instantiation. Also, even if you instantiate the original class, static variables and static methods are managed in one place. (= Each instance does not have its own static variable.) Only static variables or static methods can be called from static methods.

You can also define a ** static initializer ** in the class that defines what happens when the class file is loaded.

static initializer


class A {
  static {
  //processing
  }
}

Access modifier

private: accessible from the same class (Default): Accessable from classes in the same package protected: accessible from the same package or subclass public: accessible from any class

Recommended Posts

Java basic learning content 5 (modifier)
Java Basic Learning Content 8 (Java API)
Java basic learning content 4 (repetition)
Java basic learning content 3 (operator / ternary operator)
Java basic learning content 9 (lambda expression)
Java basic learning content 2 (array / ArrayList)
Java learning memo (basic)
Java basic learning content 1 (literals, variables, constants)
Java Basic Learning Content 6 (Inheritance / Abstract Class / Interface)
Java learning (0)
Access modifier [Java]
For JAVA learning (2018-03-16-01)
Java learning day 5
Java basic grammar
JAVA learning history final modifier and static modifier
Java basic grammar
Java basic knowledge 1
[Java] Basic structure
[Java] [Basic] Glossary
Java basic grammar
Java basic grammar
Java exercises [Basic]
java final modifier
java learning day 2
java learning day 1
Java abstract modifier [Note]
Java learning 2 (learning calculation method)
java learning (conditional expression)
java basic knowledge memo
Java Learning (1)-Hello World
[Java] Data type ①-Basic type
Java basic date manipulation
JAVA learning history interface
Java basic naming conventions
Java learning memo (interface)
Java learning memo (inheritance)
[Java] Basic method notes
Java basic data types
Basic Java OOps concepts
Learning Java framework # 1 (Mac version)
Basic Authentication with Java 11 HttpClient
Java basic syntax + α trap
JAVA learning history interface inheritance
Java tips --StaticUtility class modifier
Java learning memo (data type)
[Java] Basic statement for beginners
Books used for learning Java
4th day of java learning
Ruby on Rails basic learning ①
[Java] Thymeleaf Basic (Spring Boot)
Implement Basic authentication in Java
Java learning memo (logical operator)
[Java] Content acquisition with HttpCliient
Java learning memo (abstract class)
[Beginner] Java basic "array" description
Java Learning 1 (learning various data types)
[Java] Basic terms in programming
Java learning memo (creating an array)
[Java] Basic types and instruction notes
Deep Learning Java from scratch 6.4 Regularization
Java to extract PDF text content