Oracle DBA Forum  

Вернуться   Oracle DBA Forum > Oracle University Official Study Notes (ENG) > Oracle 10g Java Programming > Oracle 10g Java Programming

Ответ
 
Опции темы Опции просмотра
  #1  
Старый 14.01.2010, 00:59
Marley Marley вне форума
Senior Member
 
Регистрация: 19.09.2009
Сообщений: 7,385
По умолчанию 01 Introducing the Java and Oracle Platforms

__________________
Чат форума (требуется аккаунт на github или twitter)
Ответить с цитированием
  #2  
Старый 14.01.2010, 00:59
Marley Marley вне форума
Senior Member
 
Регистрация: 19.09.2009
Сообщений: 7,385
По умолчанию Objectives



Lesson Aim

This lesson introduces the background and usefulness of the Java language. It discusses Javas position with the Oracle10g. Java is the programming language of choice for Internet applications. It has gained this status because of its robust nature, the object-orientation of the language, the depth of its predefined classes, and its write once, run anywhere deployment model. You learn how Java supports object-oriented programming and architectural neutral deployment.
__________________
Чат форума (требуется аккаунт на github или twitter)

Последний раз редактировалось Marley; 03.03.2010 в 16:44.
Ответить с цитированием
  #3  
Старый 14.01.2010, 01:00
Marley Marley вне форума
Senior Member
 
Регистрация: 19.09.2009
Сообщений: 7,385
По умолчанию What Is Java?



What Is Java?

Designed by Sun Microsystems

Java is a platform and an object-oriented programming language, which was originally developed by Sun Microsystems, Inc. It was created by James Gosling for use in consumer electronics. Because of the robustness and platform-independent nature of the language, Java soon moved beyond the consumer electronics industry and found a home on the World Wide Web. Java is a platform, which means that it is a complete development and deployment environment.

Class Libraries

Java contains a broad set of predefined classes, which contain attributes and methods that handle most of the fundamental requirements of programs. Window management, input/output, and network communication classes are included in the Java Developers Kit (JDK). The class library makes Java programming significantly easier and faster to develop when compared with other languages. JDK also contains several utilities to facilitate development processes. These utilities handle operations, such as debugging, deployment, and documentation.

Java Uses a Virtual Machine

One of the key elements of the Java language is platform independence. A Java program that is written on one platform can be deployed on any other platform. This is usually referred to as write once, run anywhere (WORA). This task is accomplished through the use of the Java Virtual Machine (JVM). JVM runs on a local machine and interprets the Java bytecode and converts it into platform-specific machine code.
__________________
Чат форума (требуется аккаунт на github или twitter)

Последний раз редактировалось Marley; 03.03.2010 в 16:47.
Ответить с цитированием
  #4  
Старый 14.01.2010, 01:00
Marley Marley вне форума
Senior Member
 
Регистрация: 19.09.2009
Сообщений: 7,385
По умолчанию Key Benefits of Java



Key Benefits of Java

Object-Oriented

An object is an entity that has data attributes, plus a set of functions that are used to manipulate the object. Java is a strongly typed language, which means that almost everything in Java is an object. The main exceptions are the primitive data types, such as integers and characters.

Interpreted and Platform Independent

Java programs are interpreted to the native machines instruction set at run time. Because Java executes under the control of a JVM, Java programs can run on any operating system that provides a JVM.

Dynamic and Distributed

Java classes can be downloaded dynamically over the network when required. In addition, Java provides extensive support for client-server and distributed programming.

Multithreaded

Java programs can contain multiple threads to carry out many tasks in parallel. Multithreading capability is built into Java and is under the control of the platform-dependent JVM.

Robust and Secure

Java has built-in capabilities to prevent memory corruption. Java automatically manages the processes of memory allocation and array bounds checking. It prohibits pointer arithmetic, and restricts objects to named spaces in memory.


Instructor Note

Historically speaking, Goslings team started using C++ initially, but soon found that C++ programs were too liable to crash, partly due to language complexity, and also because of the destructive capabilities of C++ constructs, such as pointers. To overcome these problems, Goslings team invented their own object-oriented language, called Oak. To make it robust, they eliminated problematic language constructs, and made it architecturally neutral, by fully specifying the semantics of the language and creating a virtual machine to execute the programs. Oak was designed from the ground up to look like C++ but also to reduce the learning curve for those who knew C++. Oak was renamed Java, when it gained popularity in the World Wide Web and the revolution began. The robustness, compactness, platform independence, and flexibility that had been designed for the electronics consumer market make Java the ideal language for creating Web-based programs. Because Java is an interpreted language, it is slower than C++ in terms of execution speed, but this is often unimportant when dealing with user interactions.
__________________
Чат форума (требуется аккаунт на github или twitter)

Последний раз редактировалось Marley; 03.03.2010 в 16:51.
Ответить с цитированием
  #5  
Старый 14.01.2010, 01:00
Marley Marley вне форума
Senior Member
 
Регистрация: 19.09.2009
Сообщений: 7,385
По умолчанию An Object-Oriented Approach



An Object-Oriented Approach

Object-oriented programming is a powerful and natural paradigm that is used to write application programs. The approach ensures that programs survive the changes accompanying the growth of a business and its systems. After you understand the function of each object and develop clean, reliable interfaces between the functions, you can decommission older parts of an application system without concern.

Classes provide a means to capture the structure and behavior of a real-world person, place, or thing, and represent a one-to-one mapping between the real-world object and its implementation. This one-to-one mapping tends to eliminate the typical transformations that are found in nonobject-oriented design approaches.
__________________
Чат форума (требуется аккаунт на github или twitter)

Последний раз редактировалось Marley; 03.03.2010 в 16:54.
Ответить с цитированием
  #6  
Старый 14.01.2010, 01:00
Marley Marley вне форума
Senior Member
 
Регистрация: 19.09.2009
Сообщений: 7,385
По умолчанию Platform Independence



Platform Independence


Java Is an Interpreted Language

Java program source code is stored in .java files. For example, a Java program dealing with movies in a video rental company may have files called Movie.java, Customer.java, and Rental.java.

Each .java file is compiled into a corresponding .class file with the same name. For example, a Movie.java compiles to at least one class file. (Inner classes is quite common.) But, the public Movie.java compiles to one Movie.class. These .class files contain Java bytecodes, which are platform-independent machine instructions.


Java Virtual Machine (JVM)

JVM provides the environment for running Java programs. The JVM interprets Java bytecodes into the native instruction set for the machine on which the program is currently running.

The same .class files can be executed unaltered on any platform for which a JVM is provided. For this reason, JVM is sometimes referred to as a virtual processor.


Traditional Compiled Languages

When compiling a traditional language such as C, the code written by the programmer is converted into machine instructions for the platform on which the compilation takes place. This compiled program can then run only on machines that have the same processor as that on which it was compiled, such as Intel, SPARC, or Alpha.
__________________
Чат форума (требуется аккаунт на github или twitter)

Последний раз редактировалось Marley; 03.03.2010 в 16:57.
Ответить с цитированием
  #7  
Старый 14.01.2010, 01:01
Marley Marley вне форума
Senior Member
 
Регистрация: 19.09.2009
Сообщений: 7,385
По умолчанию Java and Enterprise Internet Computing



Java and Enterprise Internet Computing

You can design Java programs as server-based components that form scalable Internet applications.

The currently accepted model for Java Internet computing divides the end-to-end application process into several logical tiers. To utilize this model, JavaSoft defined the Java2, Enterprise Edition (J2EE). There are four logical tiers:

Client Tier

When Java is needed to execute on client machines, it is typically implemented as a browser-based application. But a thin client can be just Web pages that are delivered from a server as HTML.

Presentation Tier

This is executed on a Web server. Code in this tier handles the applications presentation to the client. Common Java features for this function are servlets and JavaServer Pages (JSPs). Servlets and JSPs can each generate dynamic HTML for display as Web pages to clients.

Application (Business Logic) Tier

You can use Java on an application server to implement shareable, reusable business logic as application components. A common way to implement this is to use component models, such as Enterprise JavaBeans (EJB) and Common Object Request Broker Architecture (CORBA) objects. These two components are also to be considered during design time, when a distributed environment is required.

Data Tier

The data server not only stores data, but can also store and execute Java code, particularly where this code is data intensive or enforces validation rules pertaining to the data. You can also use Business Components, from Oracles Application Development Framework (ADF), to support the data access of your application.
__________________
Чат форума (требуется аккаунт на github или twitter)

Последний раз редактировалось Marley; 03.03.2010 в 16:59.
Ответить с цитированием
  #8  
Старый 14.01.2010, 01:01
Marley Marley вне форума
Senior Member
 
Регистрация: 19.09.2009
Сообщений: 7,385
По умолчанию Using the Java Virtual Machine



Using the Java Virtual Machine


Running Java Applications

All Java applications run within a Java Virtual Machine (JVM). JVM is invoked differently depending on whether the Java program is an application or an applet.


Applications

You can run stand-alone applications by invoking a local JVM directly from the operating system command line and supplying the name of the main class for the application. After loading the applications main class file, JVM runs the program by calling a known entry point in the class; that is, a public static method called main(...). JVM runs the code by interpreting the bytecodes in the Java program and converting bytecode into platform-specific machine instructions.


Running Java Applets

A Java applet is a special type of Java program that is used in Web pages. When a Web browser reads an HTML page with an applet tag, it downloads the applet over the network to the local system and runs the applet in a JVM that is built into the browser. The browser invokes a specific call sequence of known methods in the Java applet class to execute the Java code in the context of the browsers JVM. The applet entry points differ from the entry point that is used by JVM to run stand-alone applications.

In the case of an applet, the presentation server is not necessarily used. A Java application is quite capable, and typically is configured, to connect directly to the business logic.
Applets are not covered in this course, and are only presented here for completeness. In this course, during deployment of your application, you use the Java Web Start product.
__________________
Чат форума (требуется аккаунт на github или twitter)

Последний раз редактировалось Marley; 04.03.2010 в 09:00.
Ответить с цитированием
  #9  
Старый 14.01.2010, 01:01
Marley Marley вне форума
Senior Member
 
Регистрация: 19.09.2009
Сообщений: 7,385
По умолчанию How Does JVM Work?



How Does JVM Work?


JVM Class Loader

When a .class file is run, it may require other classes to help perform its task. These classes are loaded automatically by the class loader in JVM. The required classes may reside on the local disk or on another system across the network. JVM uses the CLASSPATH environment variable to determine the location of local .class files. The classpath can be added in run time by using the java -cp or -classpath option.

Classes that are loaded from the network are kept in a separate namespace from those on the local system. This prevents name clashes and the replacement or overriding of standard classes, malicious or otherwise.

JVM Verifier

It is the job of the verifier to make sure that the Java code that is being interpreted does not violate any of the basic rules of the Java language and that the code is from a trusted source. A trusted source is an option; and if used, the check is not performed.

This validation ensures that there are no memory access violations or other illegal actions performed.

Bytecode Interpreter

JVM is the bytecode interpreter that executes the bytecodes for the loaded class. If enabled, JVM can use just-in-time (JIT) technology to translate Java bytecodes into native machine instructions.

Memory Management

JVM keeps track of all instances in use. After an instance is no longer in use, JVM is allowed to release the memory that is used by that object. It performs the release of memory after the object is no longer needed, but not necessarily immediately. The process (thread) that JVM uses to manage dereferenced objects is called garbage collection.
__________________
Чат форума (требуется аккаунт на github или twitter)

Последний раз редактировалось Marley; 04.03.2010 в 09:03.
Ответить с цитированием
  #10  
Старый 14.01.2010, 01:02
Marley Marley вне форума
Senior Member
 
Регистрация: 19.09.2009
Сообщений: 7,385
По умолчанию Just-In-Time (JIT) Compilers



Just-In-Time (JIT) Compilers

JVMs translate Java bytecodes into native machine instructions. What happens if the same code is executed again, later in the program? In an environment without JIT compilers, the code is interpreted every time it is encountered, even if it has already been interpreted earlier in the program.

The compilers are designed to easily translate bytecode into machine code, which is optimized to run on the target platform.

Benefits of Just-In-Time Compilers

Most JVMs now support JIT compilation. JIT compilers translate bytecodes only the first time that they are encountered; if the same code is executed later, then it is automatically mapped to the corresponding native machine instruction.

JIT compilers enable Java programs to run more quickly because they obviate the need for repeated translation of bytecodes to native machine instructions. This is especially effective in repetitive code, such as loops or recursive functions. Some JIT compilers are intelligent enough to optimize groups of related bytecodes into more efficient native machine instructions.

Java HotSpot

The Java HotSpot virtual machine (VM) is a key component in maximizing the deployment of enterprise applications. It is a core component of Java 2, Standard Edition (J2SE) software, which is supported by leading application vendors and technologies. Java HotSpot VM supports virtually all aspects of development, deployment, and management of corporate applications.
__________________
Чат форума (требуется аккаунт на github или twitter)

Последний раз редактировалось Marley; 04.03.2010 в 09:05.
Ответить с цитированием
Ответ
Опции темы
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.

Быстрый переход


Текущее время: 06:56. Часовой пояс GMT +3.


Powered by vBulletin®