Java Programming Cheatsheet 不错(arvin )

来自:http://introcs.cs.princeton.edu/java/11cheatsheet/

This appendix summarizes the most commonly-used Java languagefeatures in the textbook. Here are the APIs of the most common libraries.


Hello, World.

Hello, World in Java


Editing, compiling, and executing.

Compiling Hello, World in Java


Built-in data types.

Built-in types of data


Declaration and assignment statements.

Assignment statements


Integers.

int data type

Integer expressions


Floating-point numbers.

double data type

double expressions


Booleans.

boolean data type

Boolean operators


Comparison operators.

Comparison operators

Comparison examples


Parsing command-line arguments.

parsing Command-line arguments


Math library.

Math library API

Expressions that use Java library methods
The full java.lang.Math API.


Type conversion.

Type conversion


If and if-else statements.

If-else statements


Nested if-else statement.

Nested if-else statements in Java


While and for loops.

While loop      For loop


While and for loops in Java


Break statement.

Break statement in Java


Do-while loop.

Do-while loop in Java


Switch statement.

Switch statement in Java


Arrays.

An array

Compile-time initialization.

Compile-time initialization of arrays
Typical array-processing code.
Typical array-processing code

Two-dimensional arrays.

2D array
Compile-time initialization.
2D array compile-time initialization
Ragged arrays.
Ragged arrays


Our standard output library.

Standard output API
The full StdOut API.
Anatomy of printf
Formatting codes for printf


Our standard input library.

Standard input API
The full StdIn API.


Our standard drawing library.

Standard drawing API
The full StdDraw API.


Our standard audio library.

Standard audio API
The full StdAudio API.


Redirection and piping.

Redirecting standard output             Redirecting standard input


Piping


Functions.

Anatomy of a function

Example functions


Libraries of functions.

Library abstraction


Our standard random library.

Standard random


Our standard statistics library.

Standard statistics


Using an object.

Using an object


Creating an object.

Instance variables.

Anatomy of instance variables

Constructors.

Anatomy of a constructor

Instance methods.

Anatomy of an instance method


Classes.

Anatomy of a class


Object-oriented libraries.

Object-oriented library abstraction

Java's String data type.

String library API
The full java.lang.String API.
String operations
Note: the java.lang.StringBuilderAPI is similar, but StringBuilder supports someoperations more efficiently than String (notably, string concatenation)and some operations less efficiently (notably, substring extraction).

Java's Color data type.

Color library API
The full java.awt.Color API.


Our input library.

Input API
The full In API.


Our output library.

Output API
The full Out API.


Our picture library.

Picture API
The full Picture API.


Compile-time and run-time errors.

Here's a list of errors compiled byMordechai Ben-Ari.It includes a list of common error message and typical mistakes thatgive rise to them.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值