JAVA 基础

 

一,Primitive Data Types and Operations

Variables: datatype variableName

Constants: final datatype CONSTANTNAME = VALUE

 

<!--[if !supportMisalignedColumns]--><!--[endif]-->

Numeric Data Types and Operations

 

byte

short

int

long

float

double


      

 

Shorthand Operators

+=

-=

*=

/=

%=

i++

i--

++i

--i

 

 

Numeric Type conversions

    ----------------------------------------->

byte

short

int

long

float

double

      

 

二,Method

Creating a Method:

 

modifier retrunValueType methodName (list of paraments){ //method body; }
   

 

 

 三,Array

 

dataType[] arrayRefVar; dataType arrayRefVar[];

 

 

dataType[] arrayRefVar = new dataType[arraySize]; dataType arrayRefVar[] = new dataType[arraySize];

 

 

 

 

三,String and Text I/0

 

Constructing String

String a = new String(“hello”);

String Comparisons

if (string1.equals (stirng2))  or  s1.compareTo(s2)

String Concatenation

s3 = s1.concat(s2)   or  s3 = s1 + s2

Obtaining Substrings

substring(beginIndex, endIndex); substring(index)

String Conversions

toLowerCase, toUpperCase, trim, replace(‘e’,’A’)

Finding a Character/subSting

indexOf

Conversion Array/String

toCharArray(), valueOf(xxx);

 

四,Inheritance and polymorphism

Using the super Keyword: The keyword super  refers to the superclass of the class in which super appears, it can be used in two ways:

1.         To call a superclass constructor

2.         To call a superclass method

 

Casting Objects and the instanceof Operator

 

The final Classes, Methods and Variables

The equals Method

The hashCode Method

The finalize Method

The clone Method

 

五,Abstract Classes and Interfaces

 

Variables

Constructors

Methods

Abstract class

No retrictions

Constructors are invoked by subclasses through constructor chaining,An abstract class cannot be instantiated using the new operator.

No restrictions

Interface

All variables must public static finel

No constructors.

All methods must be public abstract instance methods

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值