1-3-Features of Java-Java的特点
Features of Java-Java的特点
The primary objective of Java programming language creation was to make it portable, simple and secure programming language. Apart from this, there are also some excellent features which play an important role in the popularity of this language. The features of Java are also known as java buzzwords.
Java编程语言创建的首要目标是使其成为可移植、简单、安全的编程语言。除此以外,还有一些优秀的特性对这门语言的普及起到了重要作用。Java的特性也被称为java流行语。
A list of most important features of Java language is given below.
下面给出了Java语言最重要的特性列表。
Java Features:
特点
Simple 简单
Object-Oriented 面向对象
Portable 可移植
Platform independent 平台独立
Secured 安全
Robust 稳健
Architecture neutral 架构中立
Interpreted 解释性语言
High Performance 高效率
Multithreaded 多线程
Distributed 分布式
Dynamic 动态
Simple 简单
Java is very easy to learn, and its syntax is simple, clean and easy to understand. According to Sun, Java language is a simple programming language because:
Java语言非常容易学习,其语法简单、干净、易懂。根据Sun公司的说法,Java语言是一种简单的编程语言,因为:
Java syntax is based on C++ (so easier for programmers to learn it after C++).
Java语法是以C++为基础的(所以程序员在学习C++之后更容易学习)。
Java has removed many complicated and rarely-used features, for example, explicit pointers, operator overloading, etc.
Java去掉了许多复杂的、很少使用的功能,例如:显式指针、运算符重载等。
There is no need to remove unreferenced objects because there is an Automatic Garbage Collection in Java.
不需要删除未引用的对象,因为Java中有自动垃圾回收功能。
Object-oriented 面向对象
Java is an object-oriented programming language. Everything in Java is an object. Object-oriented means we organize our software as a combination of different types of objects that incorporates both data and behavior.
Java是一种面向对象的编程语言。Java中的所有东西都是一个对象。面向对象意味着我们将软件组织为不同类型的对象的组合,其中包含了数据和行为。
Object-oriented programming (OOPs) is a methodology that simplifies software development and maintenance by providing some rules.
面向对象编程(OOPs)是一种通过提供一些规则来简化软件开发和维护的方法论。
Basic concepts of OOPs are:
OOPs的基本概念有
Object 对象
Class 类
Inheritance 继承
Polymorphism 多态性
Abstraction 抽象
Encapsulation 封装
Platform Independent 平台独立
Java is platform independent because it is different from other languages like C, C++, etc. which are compiled into platform specific machines while Java is a write once, run anywhere language. A platform is the hardware or software environment in which a program runs.
Java是独立于平台的,因为它不同于C、C++等其他语言,其他语言是编译到特定平台的机器上的,而Java是一种一次写入,随时随地运行的语言。平台是指程序运行的硬件或软件环境。
There are two types of platforms software-based and hardware-based. Java provides a software-based platform.
平台有基于软件的和基于硬件的两种类型。Java提供了一个基于软件的平台。
The Java platform differs from most other platforms in the sense that it is a software-based platform that runs on the top of other hardware-based platforms. It has two components:
Java平台与其他大多数平台不同,它是一个基于软件的平台,运行在其他基于硬件的平台之上。它有两个组成部分:
Runtime Environment 运行时环境
API(Application Programming Interface) 应用程序编程接口
Java code can be run on multiple platforms, for example, Windows, Linux, Sun Solaris, Mac/OS, etc. Java code is compiled by the compiler and converted into bytecode. This bytecode is a platform-independent code because it can be run on multiple platforms, i.e., Write Once and Run Anywhere(WORA).
Java代码可以在多个平台上运行,例如,Windows、Linux、Sun Solaris、Mac/OS等。Java代码经编译器编译后,转换成字节码。这种字节码是一种独立于平台的代码,因为它可以在多个平台上运行,即编写一次,到处运行(WORA)。
Secured 安全
Java is best known for its security. With Java, we can develop virus-free systems. Java is secured because:
Java以其安全性最为著名。利用Java,我们可以开发出无病毒的系统。Java之所以安全,是因为:
No explicit pointer 没有显式针
Java Programs run inside a virtual machine sandbox Java程序在虚拟机沙盒内运行
how Java is secured Java是怎样安全的
Classloader: Classloader in Java is a part of the Java Runtime Environment(JRE) which is used to load Java classes into the Java Virtual Machine dynamically. It adds security by separating the package for the classes of the local file system from those that are imported from network sources.
Classloader:Java中的Classloader是Java Runtime Environment(JRE)的一部分,用于将Java类动态加载到Java虚拟机中。它通过将本地文件系统的类的包与从网络源导入的类分开来增加安全性。
Bytecode Verifier: It checks the code fragments for illegal code that can violate access right to objects.
Bytecode Verifier:它检查代码片段中是否有可能侵犯对象访问权的非法代码。
Security Manager: It determines what resources a class can access such as reading and writing to the local disk.
安全管理器:它决定一个类可以访问哪些资源。它决定一个类可以访问哪些资源,比如对本地磁盘的读写。
Java language provides these securities by default. Some security can also be provided by an application developer explicitly through SSL, JAAS, Cryptography, etc.
Java语言默认提供了这些安全机制。一些安全性也可以由应用开发者通过SSL、JAAS、密码学等方式明确指定。
Robust 稳健
Robust simply means strong. Java is robust because:
Robust简单来说就是强壮的意思。Java之所以强大,是因为:
It uses strong memory management.
它使用强大的内存管理。
There is a lack of pointers that avoids security problems.
不直接使用指针,避免了安全问题。
There is automatic garbage collection in java which runs on the Java Virtual Machine to get rid of objects which are not being used by a Java application anymore.
java中有自动垃圾收集功能,它在Java虚拟机上运行,可以自动清理Java应用程序不再使用的对象。
There are exception handling and the type checking mechanism in Java. All these points make Java robust.
Java中还有异常处理和类型检查机制。所有这些点都使得Java具有健壮性。
Architecture-neutral 架构中立
Java is architecture neutral because there are no implementation dependent features, for example, the size of primitive types is fixed.
Java是架构中立的,因为没有依赖于实现的特性,例如,基本类型的大小是固定的。
In C programming, int data type occupies 2 bytes of memory for 32-bit architecture and 4 bytes of memory for 64-bit architecture. However, it occupies 4 bytes of memory for both 32 and 64-bit architectures in Java.
在C语言编程中,int数据类型在32位架构下占用2个字节的内存,在64位架构下占用4个字节的内存。但是,在Java中,32位和64位架构下,它都会占用4个字节的内存。
Portable 可移植
Java is portable because it facilitates you to carry the Java bytecode to any platform. It doesn't require any implementation.
Java是可移植的,因为它方便你将Java字节码携带到任何平台。它不需要重新编写。
High-performance 高性能
Java is faster than other traditional interpreted programming languages because Java bytecode is "close" to native code. It is still a little bit slower than a compiled language (e.g., C++). Java is an interpreted language that is why it is slower than compiled languages, e.g., C, C++, etc.
Java比其他传统的解释型编程语言快,因为Java字节码 "接近 "本地代码。它比编译语言(如C++)还是要慢一点。Java是一种解释型语言,所以它比编译型语言(如C、C++等)慢。
Distributed 分布式
Java is distributed because it facilitates users to create distributed applications in Java. RMI and EJB are used for creating distributed applications. This feature of Java makes us able to access files by calling the methods from any machine on the internet.
Java是分布式的,因为它方便用户用Java创建分布式应用。RMI和EJB是便用来创建分布式应用的。Java的这一特性使得我们能够从互联网上的任何一台机器上调用方法来访问文件。
Multi-threaded 多线程
A thread is like a separate program, executing concurrently. We can write Java programs that deal with many tasks at once by defining multiple threads. The main advantage of multi-threading is that it doesn't occupy memory for each thread. It shares a common memory area. Threads are important for multi-media, Web applications, etc.
一个线程就像一个独立的程序,并发执行。我们可以通过定义多个线程来编写同时处理许多任务的Java程序。多线程的主要优点是它不占用每个线程的内存。它共享一个公共的内存区域。线程对于多媒体、Web应用等都很重要。
Dynamic 动态性
Java is a dynamic language. It supports dynamic loading of classes. It means classes are loaded on demand. It also supports functions from its native languages, i.e., C and C++.
Java是一种动态语言。它支持类的动态加载。这意味着类是按需加载的。它还支持来自其本地语言的函数,即C和C++。
Java supports dynamic compilation and automatic memory management (garbage collection).
Java支持动态编译和自动内存管理(垃圾回收)。
浙公网安备 33010602011771号