[JAVA] Basic knowledge
[1] Flow until execution
- ① Source code description strong> dd>
- ・ Code written by people dd>
- ② Compile execution strong> dd>
- -Conversion from source code to bytecode dd>
- -Software called a compiler implements dd>
- ② Bytecode execution strong> dd>
- ・ Bytecode → Conversion to machine language dd>
- -Run with software called an interpreter dd>
- -The interpreter is executed by a mechanism called JVM dd>
- ④ Instruct the CPU of the computer dd>
[2] Variables
- How to name variables strong> dd>
- ・ Do not use about 50 prohibited words dd>
- -Basically start with a lowercase letter, and when combining two or more words, capitalize the first letter of the second word dd>
- Data firm dd>
- -Integers are basically "int" dd>
- ・ A few are basically "double" dd>
- -The boolean value is "boolen" dd>
- ・ Character with only one character is "char" dd>
- -The character string is "String" dd>
## [3] Operator / Operand
- Operator strong> Elements that make up the calculation formula [=, +, *, /,%] dd>
- Operand strong> Other values used in the code dd>
- Literal strong> Value set in the source code dd>
## [4] Escape sequence
- Basic idea strong> dd>
- Normally, "means the start or end of a character string. However, by putting \, which is one of the escape sequences, before", "" is recognized as a character string. Strong> dd>
## [5] Operator evaluation mechanism
- Concept of evaluation order of calculation formula dd>
- * * Same order as learned in mathematics * dd>
- ・ Priority 1: Multiplication / Division dd>
- ・ Priority 2: Addition / subtraction dd>
- ・ Exception: When enclosed in (), the calculation in () has priority dd>
- ・ + operator is evaluated from the left, = operator is evaluated from the right dd>
[6] Types of operators
- Basic operators strong> dd>
- [+, ー, *, /,%] dd>
- Note the following when dividing strong> dd>
- [/] em> In the case of a calculation in which there is a remainder between integers (example: 9/2), the quotient is returned (example: 4). Therefore, when finding the correct value, use a small number of either operand (example: 9.0 / 2) dd>
- [%] em> Calculate the remainder dd>
- Assignment operator strong> dd>
- ・ a ○ = 1 → agree with a = a ○ 1 ※ ○ is an operator dd>
- Increment Decrement strong> dd>
- ・ a ++ → Same meaning as a = a + 1 (increment) dd>
- ・ a--→ Same meaning as a = a-1 (decrement) dd>
## [7] Automatic type conversion at the time of substitution
- ・ Basic idea strong>
- "In principle, only that type can be assigned to a variable declared with a certain type. However, each numeric type has a magnitude relation, and the value of a small type → the assignment to a large type is automatically converted." / dd>