Program diary of fledgling brain muscle Summarize what you have learned
--Grammar type that follows C / C ++ --Object-oriented language --Static type language --Variables, arguments and return values must be typed! !!
Java Virtual Machine(JVM/JavaVM) --A virtual machine that can interpret and execute Java binary format as it is --Get common execution results by using a dedicated Java VM for each OS
--Defining a program that can collectively define states / situations and behaviors / behaviors
Car class | condition | Behavior / behavior |
---|---|---|
Vehicle type color Number of doors |
Run Bend Go down |
class class name(){
Define state / situation
Define behavior / behavior
}
--Definition of __ "behavior" and "behavior" __ in the class
class class name(){
Define state / behavior
Return type method name(argument){
Behavior / behavior processing
}
}
--Use (call) a method --When the caller calls the method, the processing in the method is executed and the processing result is returned to the caller. --Arguments --When calling the method, pass the information required for processing as __ "argument" __
--What is the main method? --Method executed when the program is started ――The way of definition is decided
public static void main(String[] args){
}
Data type | Model name | Contents | Range of values |
---|---|---|---|
Integer type | int long byte |
32-bit integer 64-bit integer 8-bit integer |
abridgement abridgement abridgement |
Real type | float double |
32-bit single precision real number 64-bit single precision real number |
abridgement abridgement |
Character type | char | 1 character | abridgement |
Logical type | boolean | Two-valued logical value | true or false |
--Java variables --Java variables always require "type definition" -Unable to assign a value other than the defined type to a variable ――This is called "static typing"
Type name Variable name = Initial value;
int a = 10;
--Field --Variables declared inside the class definition --Local variables --Variables declared inside the method definition
public class sample{
//field
String name = "Taro";
//Method
public void walk(){
//Local variables
int age = 20;
}
}
Recommended Posts