(1)chaper 1: Introduction

Three advantages:
platform independence
security
network-mobility
These three facets of java's architecture work together to make java suitable for the emerging networked computing environment.

The architecture:
the java programming language
the java class file format
the java application programming interface(api)
the java virtual machine

[img]http://dl.iteye.com/upload/attachment/238585/42cb0022-a5b5-352d-9805-71f4296e2334.jpg[/img]

The Java Virtual Machine
main job: to load class files and execute the bytecodes they contain.
[img]http://dl.iteye.com/upload/attachment/238589/8ccbfdb9-bc40-3114-b01d-40d425d69a50.jpg[/img]
Execution engines are different depending on the implementation of JVM. But can divided into two kinds:
1. (interpreter) interpret the bytecodes on at a time(slow but consume fewer memory)
2. just-in-time compiler: bytecodes of method are compiled to native machine code the first time the method is invoked. The native code then is cached and be reused the next time be invoked.(fast but consume more memory)
(java hotspot technology make a tradeoff between these two manners)

Native methods
The way jvm communicate with the host machine.
Native methods is store in a dynamically linked library whose exact form is platform specific.(.dll in windows, and .so in linux)

Software technology adopted by java programming language:
1. object-orientation
2. multi-thread
3. structured error-handling
4. garbage collection
5. dynamic linking
5. dynamic extension

Java and C/C++
Most compelling reasons for using java is that it can enhance developer productivity, and the main disadvantage is low execution speed.
1. Java has restrictions on direct accessing of memory and require you strictly obey rules of type when working with objects. (casting type)
2. Java adopted garbage collection to deal with the releasing of memory, and it is automatically done by JVM. C++ developers need to do this work with the delete() function by themselves.
3. Java has run-time array bounds checking. (array is implemented as object in java).
C++ has no such mechanism.
4. JVM will check object reference every time they are used to make sure they are not null. But in c++, using of null reference can only program crash.
But all these advantages are come from the tradeoff of lower speed.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值