The first week of Java Basic Course gramming knowledge.

Source: Internet
Author: User
Tags bitwise bitwise operators float double variable scope

Binary
Binary commands that can be recognized by the CPU are instructions
An ordered set of program (software) instructions
Computer language refers to the communication between human and computer tools
Machine language: Refers to a language that consists entirely of binary code. In the early days, the machine language was used.
Assembly
High-level language: Features: First features, not too concerned about the implementation of the principle of the bottom of the computer. 2 closer to the natural language. 3, developers can pay more attention to the implementation of the function.
Java Sun was acquired by Oracle. Founder James Grascing
Java platform: Three Parts 1 javase Standard Edition, the necessary functions are included in the 2JAVAEE Enterprise Edition, his foundation is still the standard version of the code to achieve the implementation of 3JAVAME embedded version, he is also in the standard version of the implementation, as long as it is for the microwave refrigerator Mobile phone hardware card and other programs. The more common is the javase and Enterprise Editions,
The Java 1JDK Java Development Kit Java SDK is a 2jre Java runtime enviroment Java running environment that supports development and provides support for running Java programs.
Source code: Code written in a computer language. The file name that holds the source code must be the class name. java
Compile (Compil): is to convert the source code into machine code, or compiled into machine code, compiler (compiler) auxiliary compiled tool
Compiler for Java: Javac.exe
Jvm:java (JAVA virtual device) is a JRE component that converts bytecode to final instruction at run time
Source code-Compiler javac-bytecode class-jvm-instructions can be run

Waterfall Model: requirements. Analysis Design Coding Test
Agile Models: Requirements-coding-testing-requirements-coding-testing .... Infinite loops
Compiled languages: compile-time steps. will produce the results of the compilation
Interpreted language: No steps to compile. The results of the compilation are not generated. Give the source code directly to the interpreter for execution
Features of the compiled language: there will be additional compilation time overhead. 2 post-compilation performance is high
Explanatory language Features: no additional compilation time. Simple deployment. 2 Low execution efficiency

Statement: Refers to a piece of code with independent functionality.
Syntax: A combination rule for words and symbols in a language

You must use a semicolon after each statement ends
In addition to double quotes and single quotes, all symbols in other places must use English notation.
Java is a case-sensitive language.
Code that cannot satisfy the syntax, cannot be compiled


ide:integrated Development enviroment Integrated development environment (coding tools)
Java IDE 1 My Eclipse 2 eclipes


Note: Descriptive text exists only in source code and does not participate in compilation.
1 single-line comment//comment content
2 Multiline Comment/* Comment content */
3 Text comment/*;. Release Content **/

Keywords: words that have special use in your code
Identifier: A location in your code that requires a developer's own name

The naming specification for identifiers: 1 consists only of numeric letters, underscores, dollar sign $,.
2 cannot start with a number.
3 cannot repeat with keyword

Main function: When the program starts, the virtual opportunity finds the function body of the main function, and runs the statement in the function body from top to bottom, until all runs out and the program ends.

The method of naming the variables:
The name of the 1 variable is a meaningful word.
If the name consists of multiple words, except for the first word, the other words are capitalized (hump naming)

Input statement: Let the program pause, wait for the user input, the user presses the ENTER key, obtains the user input content, then the program continues to run.

Data and data types:
Data: Information that is useful, content that is stored in memory.
Data type: The collation of the data is a piece of markup in memory.

Data types in Java: basic types
What is a bit bit: (bit) the smallest unit of data stored in a computer
Number Type
Integer type: byte short int long
Real type: float double
Character (char): Used to represent a single text, using two single quotation marks to represent data
Boolean (Boolean): Used to represent both true and false states, with only true and false data
String: Used to represent any number of text. Use two double quotation marks to represent data


Variable: An area of memory used for storing data and storing data in a variable.
Define (DECLARE) variable: Data type variable name:
Assign a value to a variable: variable name = data; =: An assignment symbol that stores the data to the right of the symbol into the memory of the variable on the left.

Three elements of a variable: data type, variable name, value cannot be missing any one

Constants: An area of memory used to store data that is not mutable

When assigning a value to a variable, the assigned data must correspond to the type of the variable declaration
Strongly typed language: The type of a variable is fixed after it is declared
Weakly typed language: Variable type variable

Escape character: \, used to change the meaning of a character following a slash


Data representation of Byte,short int: writing integers directly
Long's data representation is directly written in integers, plus the suffix l
Data representation of float: write decimal, plus suffix f
The data representation of a double: decimal


1T = 1024G
1g=1024m
1m=1021kb
1kb=1024b
1b=8bit

Operator
Return type: The type of the return value

Return value: The result of the operation

Operand: A variable or constant that participates in an operation

Meta (mesh): The number of operands required for an operator

According to the number of operands: unary operator, two-ary operator, ternary operator. (The conversion operator is a unary operator)


Bitwise operators

Bitwise operations can be used for binary operations,& and operations, the two-tuple operator, is to convert the left and right sides of the number into a binary comparison, if two bits are 1, then take 1. otherwise 0

Algorithm: To solve the specific problem, the development of the calculation process.

Algorithm must have a beginning, there must be an end. However, multiple results can be produced.

Flowchart: A standardized graphic designed to solve a particular problem. Use graphics to represent the algorithm.

The role of Flowchart:
1 Tools for reading code 2 making flowcharts for analytic functions are: PPT word, etc.

Variable scope: A variable is only valid in the curly braces he declares
When declaring a variable, the variable name must not be duplicated with the variable name in the current scope.

Compares two strings for equality: string 1.equals (String 2) The expression returns a Boolean type, true for equality, and false for unequal.

An assignment expression returns a variable type that is assigned a value of the value of the variable.

Loops in JAVA: while do-while for foreach

foreach Loop: Used only to iterate over an array or collection

Process Control Statements:
Continue: Can only be written in the loop body, when the code runs to the statement, the end of the grade loop body, into the next cycle


Break: Can be written in the loop body or switch, and immediately ends the entire structure when the code runs to the statement.


Arrays: A data type used to store multiple data of the same type
Element (array Item): The data of an item in an array;
Index (subscript): The number of the element. Numbering starts from 0.
Length: The number of all elements in the array.

Minimum index = 0 Maximum index = length-1;


Declaration syntax: data type [] variable name;
Int[] UNMS; the type of//SUNMS is an array, and his element is of type int.
Assignment syntax: variable name =new data type [length];

Type default value:
Number Type: 0
char;
Boolean;false
String Null


C manipulate array elements to manipulate the variable name [subscript] as a variable

Gets the length of the array: variable name. length


foreach Loop: Used only to iterate over an array or collection

Grammar:

For (data type variable name: array) {
Loop body

}
There is no subscript for the data in the Foreach loop, only the element.
The Foreach loop is also called a read-only loop, and he does not allow the array to be modified
The traversal efficiency of foreach is higher than for loop.


Array-specific: After an array is created, the length is fixed.


The first week of Java Basic Course gramming knowledge.

Related Article

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.