`
zzy1943
  • 浏览: 50758 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

(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



The Java Virtual Machine
main job: to load class files and execute the bytecodes they contain.

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.

  • 大小: 42.6 KB
  • 大小: 21 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics