Java basics _ day01, java_day01

Source: Internet
Author: User
Tags switch case

Java basics _ day01, java_day01
I. JRE and JDK installation. JRE -- Java runtime environment contains the core class libraries of Java virtual machines and Java programs. JDK -- Java development kit effective in this console II. public static keyword III. Name of the variable or function defined by the identifier IV. Comment 1. Single line comment // comment 2, multi-line comment/* Comment content */3, document comment/** comment content */5, constant and variable constant [integer, decimal, Boolean, character, String, null], variable [defined changeable value] 1. double is the memory unit occupied by double-precision real numbers. 64-bit valid numbers are 15 ~ 16-bit
2. float is a single-precision real number that occupies 32 bits in the memory. The valid number is 6 ~ 7-digit

6. Short-circuit operator-that is, the first comparison is complete. If there is a result, the result is directly returned. If the result is not compared with the second one, & and [& (short-circuit)] 1. true & true

  2、false  & flase    flase   3、true    & flase    true   4、flase  & true      true 
2. | or [| (Short Circuit)] 1. true & true
  2、false & flase   flase   3、true  & flase   flase    4、flase  & true   flase 
3. ^ exclusive or 1. true & true flase
  2、false  & flase    flase  3、true   & flase    true  4、flase  & true     true

4. bitwise operators

 
5. Ternary Operators
Conditional expression? Result Expression 1: Result Expression 2. Example:
  1. int a=3>4?3:4;
Extension: differences between the ternary operator and the if Statement 1. The if judgment statement is a simple judgment and outputs the result after the judgment. The ternary operator has a value assignment. The ternary operator has an operation result, and if has no operation result. 2. if it is a relatively complex logical judgment, the ternary operator cannot replace the if judgment result. if it is a simple logical judgment, the ternary operator is more concise and can be selected based on different situations. If statements can be used to determine more complex logic, while triplicate operators can only determine simple operations. 8. Statement 1, if else 2, and switch case (the last break can be omitted without writing; the alternative answer in it has no sequence, but the execution sequence is that all of its matching may be completed, finally, execute default; end feature, run to break or braces) 3. while loop 4. do while loop (the difference between while and do while, do while no matter whether the condition is met, loop body must be executed at least once) 5. for, you can add labels, specify the position or loop body for the break or countinue to jump out or end [1], simple for loop [2], and enhanced for loop. The main advantages are the traversal set and array. Extension --
[1]. Differences between the switch case and if statements: 1. The case value in the switch case statement is generally a constant (or constant expression ), logical judgment expressions cannot be written. 2. if statements can be used for logical judgment or constant judgment, but it is more troublesome than switch case [2]. break jumps out of the current loop (in the loop, you can specify which level of loop to jump out, but it is generally not used) [3] countinue can only be used in the loop statement to end this time and continue the next loop
9. function main (main function) or custom function-simply put, it encapsulates the function code 10. array-a collection of the same type of data, which is actually a container. 1. the badge starts from 0. 2. Two creation methods: [1] and int ar [] = new int [5]; <==> element type name [] = new element type [number of elements or array length]; [2]. Element type [] array name = new element type [] {element, element ,......};

Int [] arr = new int [] {3, 5, 1, 7 };

Int [] arr = {3, 5, 1, 7 };

3. Both basic data types and reference data types can be saved in the array. 11. Basic concepts of hexadecimal notation (negative numbers are represented in hexadecimal notation, which is the inverse of binary notation, plus "1": the highest binary digit of a negative number is 1) Level 2
Base data type conversion 1. Forced type conversion 2. Automatic type upgrade 13. Calculation of characters and numbers and calculation of strings and numbers difference-when the character type and value are computed, virtual opportunity automatically converts the character type to the unicode corresponding to the character for calculation 14. Java memory knowledge 1. Register CPU (processor) usage, which we cannot control in memory
2. The stack memory stores the basic data type and Object Reference (the object itself is not placed in the stack and only stores the object reference). Once used up, it will be released, 3. heap memory stores all objects) 1. Each entity in heap memory has a corresponding memory address value in stack memory. 2. Each entity in heap memory has an initialization value, different types of data have different initialization values. Int 0 double 0.0 char \ u0000 Boolean false 3. When the object becomes garbage, it is automatically recycled to release garbage 4. Method Area (also known as static zone) -- like the heap memory, it is shared by all threads. The method area contains all the class and static variables. The method area contains unique elements in the entire program. 5. Local method area.

15. keyboard class-corresponds to the standard keyboard input stream.

 

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.