Senin, 25 Juni 2018

Sponsored Links

COMIDOC | The Java Programming Language Course 2017 | Udemy ...
src: comidoc.com

Java is a concurrent, class-based, object-oriented general-purpose computer programming language, and is specifically designed to have as little implementation dependencies as possible. This is meant to let app developers "write once, run anywhere" (WORA), which means that compiled Java code can run on all platforms that support Java without the need to recompile. Java applications are usually compiled into bytecodes that can run on a Java virtual machine (JVM) regardless of computer architecture. By 2016, Java is one of the most popular programming languages ​​used, especially for client-server web applications, with 9 million developers being reported. Java was originally developed by James Gosling at Sun Microsystems (which had been acquired by Oracle Corporation) and released in 1995 as a core component of the Sun Microsystems Java platform. Language comes from many syntaxes of C and C, but has fewer lower-level facilities than both.

The original implementation and reference Java compilers, virtual machines, and class libraries were originally released by Sun under proprietary licenses. As of May 2007, according to the Java Community Process specification, Sun licenses most Java technologies under the GNU General Public License. Others have also developed alternative implementations of this Sun technology, such as the GNU Compiler for Java (bytecode compiler), GNU Classpath (standard library), and IcedTea-Web (browser plugin for applets).

The latest version is Java 10, released on March 20, 2018, which follows Java 9 after just six months according to the new release schedule. Java 8 is still supported but there will be no more security updates for Java 9. Versions earlier than Java 8 are supported by the company commercially; for example by Oracle back to Java 6 in October 2017 (while they still "strongly recommend you to remove" pre-Java 8 from at least Windows computers).


Video Java (programming language)



Histori

James Gosling, Mike Sheridan, and Patrick Naughton started the Java language project in June 1991. Java was originally designed for interactive television, but too advanced for the digital cable television industry at the time. The language was originally called Oak after an oak tree standing outside Gosling's office. Then the project went by the name Green and finally renamed Java , from Java coffee. Gosling designs Java with C/C-style syntax which by the system and applications will be familiar.

Sun Microsystems released its first public implementation as Java 1.0 in 1996. It promises "Write Once, Run Anywhere" (WORA), providing free running time on popular platforms. Quite secure and display configurable security, it allows network restrictions and file access. The main web browser soon incorporated the ability to run Java applets within web pages, and Java quickly became popular. The Java 1.0 compiler is rewritten in Java by Arthur van Hoff to completely comply with the Java 1.0 language specification. With the advent of Java 2 (released initially as J2SE 1.2 in December 1998 - 1999), the new version has several configurations built for different types of platforms. J2EE including technologies and APIs for enterprise applications typically run in server environments, while J2ME displays APIs optimized for mobile applications. The desktop version has been renamed J2SE . In 2006, for marketing purposes, Sun renamed the J2 new version as Java EE , Java ME , and Java SE , respectively.

In 1997, Sun Microsystems approached the ISO/IEC JTC 1 standard body and then Ecma International to formalize Java, but immediately withdrew from the process. Java remains a de facto standard, controlled through the Java Community Process. At one time, Sun made most of its Java implementations available at no cost, despite the status of their proprietary software. Sun generates revenue from Java through the sale of licenses for specialized products such as Java Enterprise System.

On 13 November 2006, Sun released many Java virtual machines (JVM) as free and open source software (FOSS), under the terms of the GNU General Public License (GPL). On May 8, 2007, Sun completed the process, making all of its core JVM code available under free/open source distribution terms, apart from a small piece of code that Sun does not hold copyrights.

Vice-President Sun Rich Green says that Sun's ideal role with Java is as an "evangelist". After Oracle Corporation acquired Sun Microsystems in 2009-10, Oracle described itself as "a Java technology minister with a ceaseless commitment to fostering community participation and transparency". This does not prevent Oracle from filing a lawsuit against Google soon afterwards because it uses Java inside the Android SDK (see the Google section below). The Java software works on everything from laptops to data centers, game consoles to scientific supercomputers. On April 2, 2010, James Gosling resigned from Oracle.

In January 2016, Oracle announced that the Java runtime environment based on JDK 9 would stop the browser plugin.

Principles

There are five main goals in the creation of Java language:

  1. Definitely "simple, object-oriented, and familiar".
  2. Must be "strong and secure".
  3. Must be "architecture-neutral and portable".
  4. This should work with "high performance".
  5. It should be "interpreted, threaded, and dynamic".

Version

On March 20, 2018, both Java 8 and 10 are officially supported. The major release version of Java, along with its release date:

  • JDK 1.0 (January 23, 1996)
  • JDK 1.1 (February 19, 1997)
  • J2SE 1.2 (December 8, 1998)
  • J2SE 1.3 (May 8, 2000)
  • J2SE 1.4 (February 6, 2002)
  • J2SE 5.0 (September 30, 2004)
  • Java SE 6 (December 11, 2006)
  • Java SE 7 (July 28, 2011)
  • Java SE 8 (March 18, 2014)
  • Java SE 9 (September 21, 2017)
  • Java SE 10 (March 20, 2018)

Maps Java (programming language)



Edition

Sun has defined and supported four Java editions that target multiple application environments and segment many of its APIs so that they belong to one platform. The platforms are:

  • Java Card for smartcard.
  • Java Platform, Micro Edition (Java ME) - targeting environment with limited resources.
  • The Java Platform, Standard Edition (Java SE) - targets a workstation environment.
  • The Java Platform, Enterprise Edition (Java EE) - targets large distributed companies or the Internet environment.

The classes in the Java API are organized into separate groups called packets. Each packet contains a set of related interfaces, classes, and exceptions. View separate platforms for available package description.

Sun also provides an edition called PersonalJava that has been replaced by the standard Java ME configuration profile pairs.

Java Geek Design. Java Programming Language . Geek Glasses ...
src: previews.123rf.com


Execution System

Java JVM and Bytecode

One of Java's design goals is portability, which means that programs written for the Java platform must run the same on any combination of hardware and operating systems with adequate runtime support. This is achieved by compiling the Java language code into an intermediate representation called Java bytecode instead of directly to machine-specific code architecture. Java bytecode instructions are analogous to machine code, but they are intended to be run by a virtual machine (VM) written specifically for the host hardware. End users typically use the Java Runtime Environment (JRE) installed on their own machines for standalone Java applications, or in web browsers for Java applets.

Standard libraries provide a common way to access host-specific features like graphics, threading, and networking.

The use of universal bytecode makes porting simple. However, overhead interpreting bytecode to machine instructions makes the program interpreted almost always run slower than the original executables. Just-in-time (JIT) compilers that compile bytecodes to machine code during the process time are introduced from the initial stage. Java itself is platform-independent and tailored to a specific platform to be run by a Java virtual machine for it, which translates Java bytecode into machine platform language.


Kinerja

Programs written in Java have a slower reputation and require more memory than those written in C. However, Java program execution speed increased significantly with the introduction of just-in-time compilation in 1997/1998 for Java 1.1, the addition of language features that support better code analysis (such as inner classes, StringBuilder classes, optional statements, etc.) , and optimizations in a Java virtual machine, such as HotSpot being the default for Sun's JVM in 2000. With Java 1.5, performance is enhanced by the addition of the java.util.concurrent package, including the free implementation of ConcurrentMaps and other multi-core collections, and it is enhanced further with Java 1.6.

Non-JVM

Some platforms offer direct hardware support for Java; there are microcontrollers that can run Java bytecode in hardware rather than virtual Java software, and some ARM-based processors can have hardware support to execute Java bytecodes through their Jazelle options, although most support has been dropped in current ARM implementations.


Automatic memory management

Java uses an automatic garbage collector to manage memory in the object's life cycle. The programmer determines when the object is created, and the Java runtime is responsible for recovering the memory after the object is no longer in use. Once there is no reference to the remaining object, unreachable memory becomes eligible for automatic release by the garbage collector. Something similar to a memory leak may still occur if the programmer code stores references to objects that are no longer needed, usually when objects that are no longer needed are stored in containers that are still in use. If a method for a non-existing object is called, "null pointer exception" is thrown.

One of the ideas behind Java's automated memory management model is that programmers can be spared the burden of having to perform manual memory management. In some languages, memory for object creation is implicitly allocated on the stack or explicitly allocated and allocated from the heap. In the latter case, the responsibility of managing memory exists on the programmer. If the program does not redirect the object, a memory leak occurs. If the program tries to access or cancel a canceled memory allocation, the result is undefined and unpredictable, and the program tends to become unstable or crash. This can be partially overcome by the use of smart pointers, but this adds to overhead and complexity. Note that garbage collection does not prevent a "logical" memory leak, ie , the place where memory is still referenced but never used.

Garbage collection can happen anytime. Ideally, it will happen when a program is inactive. This is guaranteed to be triggered if there is not enough free memory on the heap to allocate a new object; this can cause the program to pause. Explicit memory management is not possible in Java.

Java does not support C/C style pointers arithmetic, where object addresses and unsigned integers (usually long integers) can be used interchangeably. This allows the garbage collector to relocate the referenced object and ensure the type of security and security.

As in C and some other object-oriented languages, Java primitive data type variables are stored directly in the fields (for objects) or on the stack (for methods) rather than on the heap, as is generally true for non-primitive data. type (but see runaway analysis). This is a conscious decision by the Java designers for performance reasons.

Java contains several types of garbage collectors. By default, HotSpot uses parallel scavenger garbage collectors. However, there are also some other garbage collectors that can be used to manage the pile. For 90% of applications in Java, the same garbage collector Mark-Sapu (CMS) is sufficient. Oracle aims to replace CMS with the Garbage-First collector (G1).

Introduction to JAVA Programming - ppt video online download
src: slideplayer.com


Syntax

Java syntax is largely influenced by C. Unlike C, which combines syntax for structured, generic, and object-oriented programming, Java is built almost exclusively as an object-oriented language. All codes are written in the class, and each data item is an object, with the exception of primitive data types, ( ie integers, floating-point numbers, boolean values, and characters), which are not objects for performance reasons. Java reuses some popular aspects of C (like the printf method).

Unlike C, Java does not support operator overloading or multiple inheritance for class , although multiple inheritance is supported for the interface.

Java uses comments similar to C. There are three different comment styles: a single line style is indicated by two slashes (//), the style of multiple lines opens with /* and closes with */, and comment style Javadoc opens with /** and closes with */. The Javadoc style comment allows users to run Javadoc executable to create documentation for the program and can be read by some integrated development environment (IDE) such as Eclipse to allow developers to access documentation within the IDE.


"Hello world" contoh

"Hello World!" Traditional programs can be written in Java as:

The source file must be named after an existing public class, adding a .java suffix, for example, HelloWorldApp.java . First of all it should be compiled into bytecode, using Java compiler, generate file named HelloWorldApp.class . Only after it can be executed, or "launched". Java source files may only contain one public class, but may contain multiple classes with other than public access modifiers and any public class. When the source file contains multiple classes, create one class "public" and name the source file with the name of the public class.

An undeclared class public can be stored in any.java file. The compiler will generate a class file for each class defined in the source file. The class file name is the class name, with .class added. For the creation of class files, anonymous classes are treated as if their names are a merge of their attached class names, a $ , and an integer.

The public keyword indicates that a method may be called from a code in another class, or a class may be used by a class outside the class hierarchy. The class hierarchy is related to the name of the directory where the.java file is located. This is called an access level modifier. Other access level modifiers include the private and protected keywords.

The static keyword in front of the method shows a static method, which is only associated with the class and not with the specific instance of that class. Only static methods can be called without reference to objects. Static methods can not access any non-static class members. The unassigned static method is an instant method and requires a specific instance of a class to operate.

The void keyword indicates that the primary method does not return any value to the caller. If the Java program to come out with an error code, it should call System.exit () explicitly.

The method name " main " is not a keyword in the Java language. This is just the name of the method that Java launchers call to pass control to the program. Java classes running in managed environments such as applets and Enterprise JavaBeans do not use or require the main () method. The Java program may contain several classes that have the main method, which means that the VM must be explicitly notified of which class to launch.

The main method should accept the object array String . By convention, it is referenced as args even if other legal identifier names can be used. Since Java 5, the main method can also use variable arguments, in the form of public static void main (String... args) , allowing the main method to be called with a random number String argument. The effect of this alternative declaration is semantically identical (to the args parameter which is still an array of the String objects), but this allows alternative syntax to create and forward arrays.

The Java launcher launches Java by loading a specific class (specified on the command line or as an attribute in JAR) and starts the public static void main (String []) method. Standalone programs should express this method explicitly. The String [] args parameter is the String object array containing any arguments passed to the class. Parameters for main are often passed by using the command line.

Printing is part of the Java standard library: The System class defines a public static field called out . The out object is a PrintStream class instance and provides many methods for printing data to a standard, including println (String) also adds a new line to the forwarded string.

String "Hello World!" automatically converted to a String object by the compiler.

Example with Method


Learn Java as a First Programming Language - Java Programming ...
src: i.ytimg.com


Custom class

Applet

Java applets are programs embedded in other applications, usually on web pages displayed in web browsers. The Java applet API is now out of use since Java 9 in 2017.

Servlet

Java Servlet technology provides Web developers with a simple and consistent mechanism to extend the functionality of Web servers and to access existing business systems. Servlet is a server-side EE Java component that generates responses (usually HTML pages) to requests (usually HTTP requests) from clients.

Java servlet API to some extent has been replaced by two standard Java technologies for web services:

  • The Java API for RESTful Web Services (JAX-RS 2.0) is useful for AJAX, JSON and REST services, and
  • The Java API for XML Web Services (JAX-WS) is useful for SOAP Web Services.

JavaServer Pages

JavaServer Pages (JSP) is a server-side EE Java component that generates responses, usually HTML pages, to HTTP requests from clients. JSP embeds Java code in HTML pages by using the & lt;% and % & gt; . JSP is compiled to Java servlet , Java application in its own right, when first accessed. After that, the resulting servlet creates a response.

Swing app

Swing is a graphical user interface library for the Java SE platform. It is possible to define different look and feel through a merged view and shade system. The Windows clone, GTK, and Motif are supplied by Sun. Apple also provides the look and feel of Aqua for macOS. Where previous implementations look and feel this may be considered less, Swing in Java SE 6 solves this problem by using more gUI widgets drawing routines from the underlying platform.

Generic

In 2004, generics were added to the Java language, as part of J2SE 5.0. Before generic introduction, each variable declaration must be of a certain type. For the container class, for example, this is a problem because there is no easy way to create a container that accepts only certain types of objects. Either the container operates on all subtypes of the class or interface, usually Object , or different container classes must be created for each existing class. Generic enables checking of compile-time types without having to create multiple container classes, each containing almost identical code. In addition to allowing more efficient code, certain runtime exceptions are prevented from occurring, by issuing compile-time errors. If Java prevents all runtime type errors ( ClassCastException 's) occur, it will be the safe type.

By 2016, this type of system proved unsafe at all, proving unhealthy.

Java Tutorial Point | Javatpoint Java | Core Java Tutorialspoint ...
src: 2.bp.blogspot.com


Criticism

Critics directed at Java include generic implementation, speed, unsigned number handling, floating-point arithmetic implementation, and security vulnerability history in a major Java VM HotSpot implementation.

Singularis Software Technologies Private Limited
src: www.singularissoftwares.com


Class library

The Java Class Library is a standard library, developed to support Java application development. It is controlled by Sun Microsystems in collaboration with others through the Java Community Process program. Companies or individuals participating in this process may influence API design and development. This process has been the subject of controversy. The class library contains features such as:

  • The core library, which includes:
    • IO/NIO
    • Network
    • Reflection
    • Concurrency
    • Generic
    • Scripting/Compiler
    • Functional programming (Lambda, Streaming)
    • A collection of libraries that implement data structures such as lists, dictionaries, trees, circuits, queues, and double queues, or stacks
    • XML Processing (Parsing, Transforming, Validating) libraries
    • Security
    • Internationalization and localization libraries
  • Integration library, which allows authors of applications to communicate with external systems. This library includes:
    • The Java Database Connectivity (JDBC) API for database access
    • Java Naming and Directory Interface (JNDI) for search and discovery
    • RMI and CORBA for distributed application development
    • JMX to manage and monitor apps
  • User interface library, which includes:
    • The (heavyweight, or native) Abstract Window Toolkit (AWT), which provides GUI components, a means for laying out components and tools for handling events from those components
    • Swing (lightweight) library built in AWT but provides implementation (non-native) of the AWT widget
    • APIs for audio, processing, and playback
    • JavaFX
  • A platform-dependent implementation of the Java virtual machine which is a means by which the bytecodes of Java libraries and third-party applications are executed
  • Plugin, which allows the applet to run in a web browser
  • Java Web Start, which allows Java applications to be efficiently distributed to end users on the Internet
  • License and documentation

COMIDOC | The Java Programming Language Course 2017 | Udemy ...
src: comidoc.com


Documentation

Javadoc is a comprehensive documentation system, created by Sun Microsystems, used by many Java developers. It provides developers with an organized system to document their code. The Javadoc comment has an additional supplementary star, ie the delimiter is /** and */, whereas the normal multi-line comments in Java are triggered by the /* and */.

CSCI 224 Introduction to Java Programming. Course Objectives ...
src: images.slideplayer.com


Implementations

Oracle Corporation is the official owner of the official implementation of the Java SE platform, following the acquisition of Sun Microsystems on January 27, 2010. This implementation is based on Sun's original Java implementation. The Oracle implementation is available for Microsoft Windows (still works for XP, while newer versions are now officially supported), macOS, Linux, and Solaris. Since Java does not have formal standardization recognized by Ecma International, ISO/IEC, ANSI, or other third-party standards organizations, Oracle's implementation is the de facto standard.

The Oracle implementation is packaged in two different distributions: the Java Runtime Environment (JRE) which contains parts of the Java SE platform needed to run Java programs intended for end users, and the Java Development Kit (JDK), which is intended for software developers and includes development tools such as Java compiler, Javadoc, Jar, and debugger.

OpenJDK is another Java SE implementation licensed under the GNU GPL. Implementation begins when Sun starts releasing Java source code under the GPL. Like Java SE 7, OpenJDK is the official Java reference implementation.

The goal of Java is to make all Java implementations compatible. Historically, Sun's trademark license for the use of the Java brand confirms that all implementations must be "compatible". This resulted in legal disputes with Microsoft after Sun claimed that Microsoft's implementation did not support RMI or JNI and had added its own platform-specific features. Sun was sued in 1997, and, in 2001, won a $ 20 million settlement, as well as a court order enforcing the terms of the license from Sun. As a result, Microsoft is no longer sending Java with Windows.

Java platform-independent is very important for Java EE, and more stringent validation is required to certify implementation. This environment allows portable server-side applications.

CSCI 224 Introduction to Java Programming. Course Objectives ...
src: images.slideplayer.com


Use outside the Java platform

Java programming languages ​​require the presence of a software platform for the compiled program to be executed.

Oracle provides the Java platform for use with Java. Android SDK is an alternative software platform, used primarily to develop Android apps with its own GUI system. The Eclipse IDE platform supports Java, but it provides its own SWT GUI system.

Android

Java language is the main pillar on Android, open source mobile operating system. Although Android, built on the Linux kernel, is mostly written in C, the Android SDK uses Java as the basis for Android apps. The bytecode language supported by Android SDK is not compatible with Java bytecode and runs on its own virtual machine, optimized for low memory devices such as smartphones and tablet computers. Depending on the Android version, the bytecode is either interpreted by the Dalvik virtual machine or compiled into native code by Android Runtime.

Android does not provide a complete library of standard Java SE, although the Android SDK does not include an independent implementation of most of it. It supports Java 6 and some Java 7 features, offering implementation compatible with standard libraries (Apache Harmony).

Controversy

The use of Java-related technologies on Android causes legal disputes between Oracle and Google. On May 7, 2012, a San Francisco jury found that if the API could be copyrighted, Google has infringed Oracle's copyright by using Java on Android devices. District Judge William Haskell Alsup decided on May 31, 2012, that the API could not be copyrighted, but this was reversed by the US Court of Appeals for the Federal Circuit in May 2014. On May 26, 2016, the district court ruled in favor of Google, the copyright of the Java API on Android is reasonable use.

Java vs C app performance - Gary explains - Android Authority
src: cdn57.androidauthority.net


See also

  • Dalvik, used in older Android versions, replaced by non-JIT Android Runtime
  • JavaOne
  • Javapedia
  • List of Java virtual machines
  • List of Java APIs
  • List of JVM languages ​​
  • GraalVM, high performance Java compiler and dynamic interpreter
  • The Spring Framework

Java Comparison with other languages ​​

  • Comparison of programming languages ​​
  • Java and C Comparison
  • Comparison of C # and Java

Java Programming language #8: Wrapper class demonstration - YouTube
src: i.ytimg.com


Note




References




External links

Source of the article : Wikipedia

Comments
0 Comments