2. java oop

Preview:

DESCRIPTION

java hướng đối tượng.

Citation preview

CHUYÊN ĐỀ JAVA

JAVA VS C#

Nguyễn Hoàng Anh – nhanh@fit.hcmuns.edu.vn

Nội dung� Program Structure

� Comments

� Data Types

� Constants

� Enumerations

� Exception Handling

� Package

� Classes / Interfaces

� Constructors / Destructors

� Objects � Enumerations

� Operators

� Choices

� Loops

� Arrays

� Methods

� Strings

� Objects

� Properties

� Structs

� Console I/O

� File I/O

� Generics

2

Program StructureProgram Structure

JAVA C#

3

Program StructureProgram Structure

JAVA C#

4

CommentComment

JAVA C#

5

Data TypeData Type

JAVA C#

6

Data TypeData Type

JAVA C#

7

ConstantsConstants

JAVA C#

8

EnumerationEnumeration

JAVA C#

9

OperatorOperator

JAVA C#

10

Operator overloadingOperator overloading

JAVA C#

Không hỗ trợ

11

Không hỗ trợ

Operator overloadingOperator overloading

JAVA C#

Không hỗ trợ

12

Không hỗ trợ

Operator overloadingOperator overloading

JAVA C#

Không hỗ trợ

13

Không hỗ trợ

ChoicesChoices

JAVA C#

14

LoopLoop

JAVA C#

15

ArrayArray

JAVA C#

16

MethodMethod

JAVA C#

17

MethodMethod

JAVA C#

18

MethodMethod

JAVA C#

19

StringString

JAVA C#

20

ExceptionException

JAVA C#

21

PackagePackage

JAVA C#

22

ScopeScope

JAVA C#

23

Class / InterfaceClass / Interface

JAVA C#

24

Constructors / DestructorsConstructors / Destructors

JAVA C#

25

ObjectObject

JAVA C#

26

PropertiesProperties

JAVA C#

27

StructsStructs

JAVA C#

28

Console I/OConsole I/O

JAVA C#

29

File I/OFile I/O

JAVA C#

30

File I/OFile I/O

JAVA C#

31

None GenericsNone Generics

32

?

None GenericsNone Generics

?

33

?

None GenericsNone Generics

Compile Time:BUILD SUCCESSFUL

34

Runtime: Error

GenericsGenerics

35

GenericsGenerics

36

GenericsGenerics

Compile Time: BUILD FAILED

37

Runtime: SAFE

Generics Generics –– Collection InterfacesCollection Interfaces

CollectionCollectionCollectionCollection

SetSetSetSet ListListListList QueueQueueQueueQueue

38

SortedSetSortedSetSortedSetSortedSet

Generics Generics –– ArrayListArrayList, , LinkedListLinkedList

ListListListList

39

ArrayListArrayListArrayListArrayList LinkedListLinkedListLinkedListLinkedList

HỎI VÀ ĐÁP

40

ThamTham khảokhảo

� Frank McCown :Java (J2SE 5.0) and C# Comparison

� The Java Language Specification Third Edition

41