Java Handy Note One

Source: Internet
Author: User

If you want to engage in writing and database-related software, you can learn about JDBK, and if you want to engage in program software related to network information exchange, you can learn XML; If you want to engage in the development and design of large Web applications, you can learn Java EE; If you want to engage in embedded development and design related to the internet of things, you can learn Java ME, and if you want to develop Web programs, you can learn JSP.

Java Platform:
javase java EE javame

Java Environment setup:
Jvm:--java virtual Machine,--Execute program
Jre:--java runtime environment, including JVM and standard class libraries
Jdk:--java Development Kit, including development tools and Jre,javac Java
JVM--->JRE-->JDK
Settings for Environment variables:
Computer-Right-click Properties--Advanced settings--environment variables
--System Variable-->path

Java program writing and running steps:
1. Create a. java file
2. Writing Source code files
3. Compile source code files javac source code file name. java
4. Run the class file Java class name

Data type:
Base type: byte short int long float double char Boolean
Reference type: Class Array Interface Enumeration

Conversions between data types:
Automatic conversion: Small---> Large
byte short Char-->int
Floating-point type appears in the operand, resulting in floating-point type
Cast: Large---> Small (type)
Boolean does not participate in conversions.
Variable:
Data type variable name = value;
Operator:
Arithmetic operator: +-*/% + +--
Assignment operator: = = = =/= *=%=
comparison operator:> >= < <= = = = True/false
Logical operator:& |!   ^ && | | True/false
Trinocular Operator: (boolean-type expression)? Expression 1: Expression 2;
Identifier: class name, variable name, method name
Composition: Letters, Numbers, _,$
Rule: cannot be a number starting with a keyword in Java
Class Name: Capitalize the first letter of the word
Variable name: First word lowercase second start each word capitalize first letter
Method Name: First word lowercase second start each word capitalize first letter
Comments:
Single line://
Multiple lines:/*....*/
Documentation:/**...*/javadoc--html
String: Reference data type
String types can be connected to any type of data +
The result is a string.
eg:string s = "abc" +100;

Branch statements
If branch
if (Boolean expression) {}
if () {}else{}
if () {}else if () {}...else{}
if () {if () {}}
Switch Branch
switch (expression) {//byte short char int String enumeration
Case Constant Value: ...
Break
....
Default
Break
}
Loop statement:
While do/while for
While:0-n, first judge, then execute.
Do/while:1-n, after the first execution of judgment
while () {}
Do{}while ();
for (initialize; condition; increment) {}

Method declaration:
Modifier returns a value type method name (parameter list) {
EXECUTE statement
return value;
}

Classes and objects:
Class: The collection of objects of the same property and behavior.
Object: An instantiation of the class.

Class Name {
Property
Method
Constructors
}

Object declaration: New
Encapsulation: Private, public access to the object's properties and behavior
Set/get
Public
This: Represents a reference to the current object
1. To solve the problem of duplicate names of local variables and instance variables
2. Calling the overloaded constructor
Constructor:
1. Method name and class name are the same
2. No return value type
3. Call when executing the new statement

This (parameter list); must be placed in the first row of a non-commented line of the constructor

Array: A collection of data of the same type
Saving bulk Data
The data stored in the array has subscripts, starting with 0

Get array Length: array name. length

Exception: Out of bounds, null pointer

for (element type variable name: array name) {
Statement
}

String[] args: Receive command line arguments
Data Type ... Variable Name: array

Java Handy Note One

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.