Java package usage, data types, and operators, Process Control

Source: Internet
Author: User

Api:

Java.lang language packs can be used without importing
Java.awt/javax.swing/java.awt.event Graphical GUI
Java.applet Small application packages can be nested in Web pages to run
java.io Input/Output package
The class that uses the package structure needs to be imported import java.util.Date first; Date D=new date ();
--import java.util.*; --import can import all classes under a package

If you do not import java.util.Date d=new java.util.Date () in advance;
java.net Network Programming Package
JAVA.UTIL Toolkit defines data structure date time ...

Java identifiers: Letters, numbers, underscores, $
--Cannot start with a number, case-sensitive, letters can contain Chinese characters, cannot conflict with keywords, unlimited length


Keyword: goto, const is a reserved word for Java sizeof has no meaning in Java


Data type: boolean --integer value and bool value cannot be generalized, Boolean can only be true or false
   byte  --8-bit integer   -128~+127
   char  --16-bit Unicode character,unsigned 16-bit integer, Case difference 32   0~65535
   double --64-bit floating-point number
   float  -- 32-bit floating-point number
   int  --32-bit integer  -2^31~+2^31-1
   Long  --64-bit integer  -2^63~+2^63-1  long assignment   Long a=124567l --l case can be
    Short  --16-bit integer  -32768~+32767
  Note: integer types in Java are signed, char defaults to unsigned 16-bit integers
  Note: string is an object/class that does not belong to eight data types in Java and does not end with A/s flag
  NOTE: If any of the values are strongly converted to a value lower than his range, the system does a direct truncation and truncates the higher range
  Note: Do not directly compare two implementation values, the implementation is worth storing in the machine is infinitely close to a certain number, even if the same two implementation values they are not equal


Data type classification: 1, basic type 8 kinds
2, class example: String s= "Hello", storage relationship--s Reference (address) to Hello, Hello is an object, pointer operation is not allowed
Difference: Different storage methods
Note: There is a garbage collection mechanism in Java that automatically cleans up garbage when there is not enough space.
The Java Virtual machine can only be recommended to start the garbage collection mechanism, but does not necessarily execute--SYSTEM.GC ();


Operator: Java-specific relational operator instanceof--determines whether an object is an instance of a class
>>>=
>> represents a signed right shift,>>> unsigned right shift
When the left shift exceeds its data type bits, Java moves the left (the number of bits required to move the data type) bit

& Bitwise AND | bitwise OR

Logical operators:
Short-circuit and OR operator:&& | | No Short circuit:& |


Process Control:
Note: if (Boolean) cannot use integer value, only bool value,
Switch (integer) Byte,short,int,char, note: The long type is excluded and jdk5.0 is used for enumeration;
break[Statement label] Label can only be placed before the loop statement, similar to the role of Goto
continue[Statement Label]

Java package usage, data types, and operators, Process Control

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.