Java Foundation day02

Source: Internet
Author: User
Tags arithmetic arithmetic operators logical operators

Knowledge Summary
1. Variables: The amount of content that can change within a certain range during a program run.
2. How to use variables:
A) One step:
Data type variable name = data value;
b) Two steps:
Data type variable name;
Variable name = data value;
3. Identifiers: See name and Meaning. Class name Capital of each word (camel); variable name the first word in lowercase, beginning with the first letter of the second word.
4. Data types (basic types and reference types), the basic types are divided into:
A) integer type: Byte, short, int, long
b) Floating-point type: float, double
c) Character type: Char
d) Boolean type: Boolean
5. Operator: a symbol that operates on a constant or variable.
6. Expression: An equation that is connected with an operator.
7. Arithmetic operators:
A) Arithmetic: +-*/
b) modulo operation:% (see remainder only)
c) String connection: Any data type and string concatenated together, are
String result
d) Self-increment decrement operator, no difference before and after use, but mixed
There are significant differences in use
I. Before + +, first add after use
II. After + +, first use after add
8. Assignment operators:
A) Basic: =
b) Composite: + = = *=/=%= A + = 3 as a = a + 3
9. Comparison operators:> < >= <= = =! =
10. Logical operators:
a) and &&&
b) or | | |
c) also or ^
d) No!
One. Scanner keyboard input three steps:
A) Guide package: Import Java.util.Scanner
b) Created: Scanner sc = new Scanner (system.in)
c) Use:
I. Get int value: int num = Sc.nextint ();
II. Get string: String str = Sc.next ();

Java Foundation day02

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.