Java study notes 1 - Java catalog creation process and input and output
1. Create a program
Then a window appears, just name it and add the option of sring[]
2. Input and output
package hello;
import java.util.Scanner;
public class Hello {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Hello World!"); //输出语句
Scanner in = new Scanner(System.in); //输入语句
System.out.println(in.nextLine()); //将输入的输出
}
}
System.out.println("echo:" + in.nextLine()); //输出的简单语法
System.out.println("2+3="+5); //输出5 正确
System.out.println("2+3="+2+3); //输出23 错误 如需改正,需要加上括号 +(2+3)即可
//但是如果2+3在前面时,的输出是5
3. Pay attention to the realization
- Do not run multiple programs when running, otherwise it will increase the burden on the computer
- Press shift + down arrow key to select multiple lines
- ctrl + / to realize the comment of the selected line, or to clear the comment
- Every time in.nextInt() reads an integer