[Java] Introduction to java for the first time #2

1 minute read

Development flow

1, source code creation Describe the grammar defined by java in source code

  1. Compile Performs a process called compile on the source code and converts it into a state called bytecode

3, execution After compiling, execute bytecode to software called interpreter

Important consciousness

describe exactly

Enter alphanumeric characters in half-width Don’t make a mistake in similar characters

From outside to inside, not from top to bottom

I don’t know if I’ve closed the brackets, so be aware of opening and closing

Write easy-to-read code

Write source code that is easy for anyone to read

indent

Indentation to make it easier to see the multiple structure of blocks

public class Main {
  public static void main(String[] args) {
    System.out.println("hello, world!");
}
}

comment

You can add commentary to the source code Program compile time ignored at run time

/* body of comment (multiple lines allowed) */

// body of comment (up to end of line)

variable

A variable is like a box prepared inside a computer to store data.

Variable declaration statement

type variable name;
public class Main {
public static void main(String[] args) {
int age;
age = 30;
System.out.println(age);
}
}

constant declaration method

final type constant name = initial value;
public class Main {
public static void main(String[] args) {
final double TAX = 1.08;
int fax = 5;
System.out.println(fax * TAX + "10,000 yen");
}
}

Tags:

Updated: