Road Java based learning, - notes day3

Today, the target
is able to know the difference between the & && and
can be used to retrieve a two ternary operator to the bigger values
can be completed using the keyboard input data and two data summation
can be used to complete the HelloWorld IDEA cases
to know IDEA project structure
can be used IDEA complete the import module
1, the comparison operators
<<=>> = ==! =
summary: the results of comparison operators are the boolean true or false

2, logical operators
& (and)
| (or)
! (Non) negated

&& (short-circuit and)
has the effect of a short circuit, the left is false, the right is no longer running. True left and right execution.

|| (or short circuit)
has a short circuit effect, the left side is true, the right is no longer operating; left is false, the right execution.

3, ternary operator

1 expression? Expression 2: Expression 3;
If true, the result is an expression 2;

4, keyboard input
to achieve step
(1) leader packet

import java.util.Scanner;

(2) create objects Scanner

Scanner sc = new Scanner(System.in);//sc为变量名,不一定命名sc

(3) receive data (keyboard input)

int a = sc.nextInt();//sc.nextInt() 开启了键盘录入  输入int类型

5, IDEA project structure

project project
module template
package package
class class

Here Insert Picture Description

Published 12 original articles · won praise 2 · Views 1946

Guess you like

Origin blog.csdn.net/ytzang/article/details/104301313