Java Basic Notes

Source: Internet
Author: User
Tags case statement logical operators naming convention

Learning Java has been one months, feeling a lot of learning, there is no sense of learning what. So decided at the beginning of the new Year. Summarize the notes of this one-month study. Extract the essence for later review and use.

Java programming should be aware of the following points 1, case sensitive 2, class name: For all classes, the first letter of the class name should be uppercase, if the class name has a number of words, the first letter of each word should be capitalized 3, method name: All method names should start with lowercase. If the method name contains several words, the first letter of each subsequent word is capitalized. 4. Source files: The source file name must be the same as the class name. Java data types are divided into reference types and underlying data types there are 8 types of basic data types: Byte,short,int,long floating-point: float,double character: Char Data conversion Boolean type: Boolean1, Downward transformation (small type to large type/auto) 2, upward transformation (large type to small type/cast) 3, instanceof operator, used to detect the referenced object type Java wrapper classThe Java language is an object-oriented language, but The basic data types in Java are not object-oriented, which in practical use there are a lot of inconvenience, in order to solve this problem, When designing a class, a corresponding class is represented for each base data type, so that the classes corresponding to the eight and the basic data types are collectively referred to as wrapper classes (Wrapper Class), and some are translated into the outer or data type classes. wrapper class Correspondence table

Basic data types

Packing class

byte

byte

boolean

boolean

short

short

char

character

int

integer

long

long

float

float

double

double

in these eight class names, except for the Integer and Character classes, the class names and basic data types of the other six classes have been Only the first letter of the class name can be capitalized.

Java Operators

Mathematical operators

+ - * / %

Self-increment decrement budget symbol

++ --

i++ i--first assignment in arithmetic

++i-First operation in assignment
logical Operators with (and) && or (or) | | non (otherwise)! Note && | | is called short-circuit operator, short-circuit operator "condition 1&& condition 2" If condition 1 is wrong, condition 2 does not execute& | Non-short-circuit operator regardless of how two conditions will be executedcomparison Operators> Greater than< less than>= greater than or equal to<= less than or equal to= = equals! = does not equalConditional Operatorsconditional operator expression syntax (ternary operator)"conditional expression? Expression 1: Expression 2 " conditional expression is true to execute an expression 1
Java Process Control IF--elseif---Else statement switch-case statement while loop statement do While loop statement for Loop Java array key knowledge int ary=={} Represents the initialization of an empty array array of length using arr.length, the length of the string using Str.length () ary[ary.length-1] to denote the last element identifier and keyword identifier of the array used to indicate the variable name, class name, A naming convention such as method name and file name in a Class 1, with letters, numbers, underscores, and $, cannot begin with a number. 2, Case sensitive 3, do not use keywords and reserved keywords in Java: All lowercase, jdk1.2 more strictfp (precision floating-point type), the keyword jdk1.4 more assert (assertion) keyword jdk1.5 more enum (enum) keyword True False null is strictly not a keyword, it should be called reserved word naming habits 1, identifiers to conform to semantic information. 2, the package name has the letter lowercase 3, the class name each word first letter capital, other lowercase. TERENASTRUDENT4, variables, and methods: first word lowercase, starting with the second word capitalize//5, constant: All letters capitalized, with "_" between each word use "_" to concatenate common transfer characters \ n Enter (\u000a)
\ t Horizontal tab (\U0009)
\b Space (\u0008)
\ r line Break (\u000d)
\f Page Change (\u000c)
"\ '" single quotation mark (\u0027)
"\" double quotation marks (\u0022)
"\ \" backslash (\u005c)
\DDD three-bit octal
\UDDDD four-bit hex directly to string! is part of a string  

Java Basic Notes

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.