Introduction to Java

Introduction to Java

Java is the general term for the Java object-oriented programming language and Java platform launched by Sun Microsystems in May 1995. Developed by James Gosling and colleagues, it was officially launched in 1995.

Java is divided into three systems:

  • JavaSE (J2SE) (Java2 Platform Standard Edition, Java Platform Standard Edition)
  • JavaEE (J2EE) (Java 2 Platform, Enterprise Edition, Java Platform Enterprise Edition)
  • JavaME (J2ME) (Java 2 Platform Micro Edition, java platform micro edition).

In June 2005, the JavaOne conference was held, and SUN released Java SE 6. At this point, various versions of Java have been renamed to remove the number "2" in them: J2EE was renamed Java EE, J2SE was renamed Java SE, and J2ME was renamed Java ME.

Main features

  • The Java language is simple:

    The syntax of the Java language is very close to that of the C and C++ languages, making it easy for most programmers to learn and use. Java, on the other hand, discards rarely used, hard-to-understand, and confusing features of C++, such as operator overloading, multiple inheritance, and automatic type casting. In particular, the Java language does not use pointers, but references. And provides automatic garbage collection, so that programmers do not have to worry about memory management.

  • The Java language is object-oriented:

    The Java language provides object-oriented features such as classes, interfaces and inheritance. For the sake of simplicity, it only supports single inheritance between classes, but supports multiple inheritance between interfaces, and supports the implementation mechanism between classes and interfaces (the keyword is implements). The Java language fully supports dynamic binding, while the C++ language only uses dynamic binding for virtual functions. In short, the Java language is a pure object-oriented programming language.

  • The Java language is distributed:

    The Java language supports the development of Internet applications. There is a network application programming interface (java net) in the basic Java application programming interface, which provides a class library for network application programming, including URL, URLConnection, Socket, ServerSocket and so on. Java's RMI (Remote Method Activation) mechanism is also an important means of developing distributed applications.

  • The Java language is robust:

    Java's strong type mechanism, exception handling, and automatic garbage collection are important guarantees for the robustness of Java programs. Discarding pointers is a sensible choice for Java. Java's security checking mechanism makes Java more robust.

  • The Java language is safe:

    Java is usually used in the network environment, for this, Java provides a security mechanism to prevent malicious code attacks. In addition to many security features of the Java language, Java has a security precaution mechanism (class ClassLoader) for classes downloaded over the network, such as assigning different namespaces to prevent replacement of local classes of the same name, byte code checking, and providing security management The mechanism (class SecurityManager) lets Java applications set up security sentinels.

  • The Java language is architecture neutral:

    Java programs (files suffixed with java) are compiled on the Java platform into an architecture-neutral bytecode format (files suffixed with class), which can then be run on any system that implements the Java platform. This approach is suitable for heterogeneous network environments and software distribution.

  • The Java language is portable:

    This portability comes from architecture neutrality, in addition, Java also strictly stipulates the length of each basic data type. The Java system itself also has strong portability. The Java compiler is implemented in Java, and the Java runtime environment is implemented in ANSI C.

  • The Java language is interpreted:

    As mentioned earlier, Java programs are compiled into bytecode format on the Java platform, which can then be run on any system that implements this Java platform. At runtime, the Java interpreter in the Java platform interprets and executes these bytecodes, and the classes required in the execution process are loaded into the runtime environment in the linking phase.

  • Java is high performance:

    Compared to those interpreted high-level scripting languages, Java is indeed high performance. In fact, Java's running speed is getting closer and closer to C++ with the development of JIT (Just-In-Time) compiler technology.

  • Java语言是多线程的:

    在Java语言中,线程是一种特殊的对象,它必须由Thread类或其子(孙)类来创建。通常有两种方法来创建线程:其一,使用型构为Thread(Runnable)的构造子将一个实现了Runnable接口的对象包装成一个线程,其二,从Thread类派生出子类并重写run方法,使用该子类创建的对象即为线程。值得注意的是Thread类已经实现了Runnable接口,因此,任何一个线程均有它的run方法,而run方法中包含了线程所要运行的代码。线程的活动由一组方法来控制。Java语言支持多个线程的同时执行,并提供多线程之间的同步机制(关键字为synchronized)。

  • Java语言是动态的:

    Java语言的设计目标之一是适应于动态变化的环境。Java程序需要的类能够动态地被载入到运行环境,也可以通过网络来载入所需要的类。这也有利于软件的升级。另外,Java中的类有一个运行时刻的表示,能进行运行时刻的类型检查。


发展历史

  • 1995年5月23日,Java语言诞生
  • 1996年1月,第一个JDK-JDK1.0诞生
  • 1996年4月,10个最主要的操作系统供应商申明将在其产品中嵌入JAVA技术
  • 1996年9月,约8.3万个网页应用了JAVA技术来制作
  • 1997年2月18日,JDK1.1发布
  • 1997年4月2日,JavaOne会议召开,参与者逾一万人,创当时全球同类会议规模之纪录
  • 1997年9月,JavaDeveloperConnection社区成员超过十万
  • 1998年2月,JDK1.1被下载超过2,000,000次
  • 1998年12月8日,JAVA2企业平台J2EE发布
  • 1999年6月,SUN公司发布Java的三个版本:标准版(JavaSE,以前是J2SE)、企业版(JavaEE以前是J2EE)和微型版(JavaME,以前是J2ME)
  • 2000年5月8日,JDK1.3发布
  • 2000年5月29日,JDK1.4发布
  • 2001年6月5日,NOKIA宣布,到2003年将出售1亿部支持Java的手机
  • 2001年9月24日,J2EE1.3发布
  • 2002年2月26日,J2SE1.4发布,自此Java的计算能力有了大幅提升
  • 2004年9月30日18:00PM,J2SE1.5发布,成为Java语言发展史上的又一里程碑。为了表示该版本的重要性,J2SE1.5更名为Java SE 5.0
  • 2005年6月,JavaOne大会召开,SUN公司公开Java SE 6。此时,Java的各种版本已经更名,以取消其中的数字"2":J2EE更名为Java EE,J2SE更名为Java SE,J2ME更名为Java ME
  • 2006年12月,SUN公司发布JRE6.0
  • 2009年04月20日,甲骨文74亿美元收购Sun。取得java的版权。
  • 2010年11月,由于甲骨文对于Java社区的不友善,因此Apache扬言将退出JCP[4]。
  • 2011年7月28日,甲骨文发布java7.0的正式版。
  • 2014年3月18日,Oracle公司发表Java SE 8。

Java开发工具

Java语言尽量保证系统内存在1G以上,其他工具如下所示:

安装好以上的工具后,我们就可以输出Java的第一个程序"Hello World!"

public class HelloWorld {
    public static void main ( String [ ] args ) {
        System . out . println ( " Hello World " ) ;
    }
}

在下一章节我们将介绍如何配置java开发环境。


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326627829&siteId=291194637