Basic operator, stack, array, and operator Stack

Source: Internet
Author: User
Tags try catch java keywords

Basic operator, stack, array, and operator Stack

I. Operators: priority, associativity

  To sum up one sentence: The point number is self-inverse and the value is not transferred.Ii. java keywords
InstanceofInstance VolatileEasy to lose Super parent class, superclass TransientShort Term SynchronizedThread, synchronization StrictfpStrict and accurate Package Throws declares that an exception may be thrown.
NativeLocal Throw an exception object Try catch exceptions Catch exception Run any finally exceptions Switch Case: return the result in the switch. This class
Boolean Byte type Char character short integer Int integer float floating point Double Precision long integer Default Void no return value Return
If Else and vice versa For Loop While Loop Do run Break bounce cycle Continue Null
False True Static Final ultimate, unchangeable New, create Import    
Class Extends extension and inheritance Interface Implements implementation Abstract declaration Abstraction Private Public Protected
1. Keyword: instanceof Introduction: purpose: to test whether the object on the left is an instance of the class on the right of the object, and return boolean data. For example:
String s = "I AM an Object! ";
Boolean isObject = s instanceof Object;
We declared a String Object reference, pointing to a String Object, and then using instancof to test whether the Object it points to is an instance of the Object class. Obviously, this is true, so true is returned, that is, the isObject value is True. Iii. Memory classification and functions in java 1. Four Types and functions of memory in java: (1) heap: stores new things, such as objects and arrays. (2) stack: storage reference address, basic data type variable (3) data segment: storage static constant, String constant (4) code segment (code segment): storage java class, code 2.
Iv. Some programming knowledge details 1. Data Input and compaction usage. Running in = new Processing (System. in );

Int x = in. nextInt ();

2.convert int to String (1) convert int to string: int I = 123; String s = ""; Method 1: s = I + ""; Method 2: s = String. valueOf (I );
Differences between the two methods:
(2) convert String to int
Differences between the two methods:
5. Jump Statement 1. The jump statements in java include: continue and break. Although java retains goto as a keyword, it is not used. 2. continue: the statement after the continue is not executed. 3. break: Terminate the loop and completely jump out of the loop. Vi. array 1. array: data of the same type is stored in continuous storage units. 2. Once the length of the array is declared, the size of the array cannot be changed. The length is fixed. 3. the array elements are accessed through array names and indexes. The index starts from 0. The array can be one-dimensional or multi-dimensional. 4. in java, arrays cannot be allocated in stack memory, that is, only space can be allocated for arrays from the heap memory; 5. the new operator is used to allocate memory space of the specified type from the heap and return references of the corresponding type. Its function is similar to the malloc function. 6. to declare an array in Java, use the following method: // declare only the reference of the array, but do not allocate the memory space float [] fAry; // when declaring the array, memory is allocated based on the specified length, but the array does not contain the value char [] chAry = new char [10]; // declare the array and allocate the memory, at the same time, initialize int [] ary1 = new int [] {1, 2, 3, 4, 5}; // same as the previous method, only the syntax is relatively simple int [] ary2 = {1, 2, 3, 4, 5}; 7. assignment between Arrays:
Therefore, modifying an element of an array changes the element of another array.

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.