[Java] Study notes about Java with Progate 1

1 minute read

I would like to start learning about Java, which is famous for being different from melon bread and melon, ham and hamster, from JavaScript. Go Go Jabber: swimmer_tone2::swimmer_tone2::swimmer_tone2:

Basic

System.out.println();

Is the JS console.log-like one. You can output the result to the console. Long, long. .. I complained that even console.log was long. There are two “.”! (Isn’t it the only time I’ll be complemented? But it’s only during Progate.)

What’s more, println, the shocking fact that l is a small letter “eru”. :scream: It seems to be read as a print line. ..

The Java structure is divided into three parts: class part, method part, and process in method. It seems to be good enough, but I’m sure there will be a great hint collection later. :spy_tone2:

variable

Variable definition

// variable definition
Data type variable name;
// Assign value to variable
Variable name = value;
// Can be combined. It seems to be the initialization of variables
Data type variable name = value;

Declare the data type such as int or String to the variable. And, it seems that assigning a value at the same time as defining a variable is called “variable initialization”.

Update variables


Variable name you want to update = new value;

When updating, do not type the data. If the data type is attached, it seems that a new variable will be defined, Java “I already have a variable with this name. Why do you say that again? Huh?” :sob: It seems that you will be annoyed and will throw an error, so let’s not disturb Java.

self-assignment


int X = 2;
X = X+3;

The shape you often see. First time knowing that it is called self-assignment.