Chapter 1 introduction to java technology


Published on

Published in: Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Chapter 1 introduction to java technology

  5. 9. JAVA TECHNOLOGY <ul><li>SIMPLE </li></ul><ul><li>Java was designed to make it much easier to write bug free code. Because Java is simple, it is easy to read and write. There aren't a lot of special cases or tricks that will confuse beginners. Java makes to providing bug-free code is automatic memory allocation and de allocation. </li></ul>
  6. 10. JAVA TECHNOLOGY <ul><li>OBJECT- ORIENTED </li></ul><ul><li> MORE OF THIS IN CHAPTER 2 </li></ul>
  7. 11. JAVA TECHNOLOGY <ul><li>DISTRIBUTED </li></ul><ul><li>Java has an extensive library of routines for coping easily with TCP/IP protocols like HTTP and FTP. This makes creating network connections much easier than in C or C++. Java applications can open and access objects across the net via URLs with the same ease that programmers are used to when accessing a local file system. </li></ul>
  8. 12. JAVA TECHNOLOGY <ul><li>INTERPRETED </li></ul><ul><li>Java byte codes are translated on the fly to native machine instructions (interpreted) and not stored anywhere. And since linking is a more incremental and lightweight process, the development process can be much more rapid and exploratory. </li></ul><ul><li>As a part of the byte code stream, more compile-time information is carried over and available at runtime. This is what the linker's type checks are based on. It also makes programs more amenable to debugging. </li></ul>
  9. 13. JAVA TECHNOLOGY <ul><li>ROBUST </li></ul><ul><li>robustness is its portability across many Operating systems, with is supported by the Java Virtual Machine. </li></ul>
  10. 14. JAVA TECHNOLOGY <ul><li>SECURE </li></ul><ul><ul><li>The Java compiler catches more compile-time errors; other languages (like C++) will compile programs that produce unpredictable results. Java does not allocate direct pointers to memory. This makes it impossible to accidentally reference memory that belongs to other programs or the kernel. </li></ul></ul>
  11. 15. JAVA TECHNOLOGY <ul><li>ARCHITECTURAL NEUTRAL </li></ul><ul><li>Java was designed to support applications on networks. In general, networks are composed of a variety of systems with a variety of CPU and operating system architectures. To enable a Java application to execute anywhere on the network, the compiler generates an architecture-neutral object file format--the compiled code is executable on many processors, given the presence of the Java runtime system.This is useful not only for networks but also for single system software distribution. In the present personal computer market, application writers have to produce versions of their application that are compatible with the IBM PC and with the Apple Macintosh. With the PC market (through Windows/NT) diversifying into many CPU architectures, and Apple moving off the 680x0 toward the PowerPC, production of software that runs on all platforms becomes nearly impossible. With Java, the same version of the application runs on all platforms. </li></ul>
  12. 16. JAVA TECHNOLOGY <ul><li>PORTABLE </li></ul><ul><li>The Java system itself is quite portable. The compiler is written in Java and the runtime is written in ANSI C with a clean portability boundary. </li></ul>
  13. 17. JAVA TECHNOLOGY <ul><li>HIGH PERFORMANCE </li></ul><ul><li>While you'll never get that last ounce of speed out of a Java program that you might be able to wring from C or Fortran, the results will be suitable for all but the most demanding applications. </li></ul><ul><li>It is certainly possible to write large programs in Java. The HotJava browser, the Eclipse integrated development environment, the LimeWire file sharing application, the jEdit text editor, the JBoss application server, the Tomcat servlet container, the Xerces XML parser, the Xalan XSLT processor, and the javac compiler are large programs that are written entirely in Java. </li></ul>
  14. 18. JAVA TECHNOLOGY <ul><li>MULTI THREADING </li></ul><ul><li>This makes Java very responsive to user input. It also helps to contribute to Java's robustness and provides a mechanism whereby the Java environment can ensure that a malicious applet doesn't steal all of the host's CPU cycles. </li></ul>
  15. 19. JAVA TECHNOLOGY <ul><li>DYNAMIC </li></ul><ul><li>In a number of ways, Java is a more dynamic language than C or C++. It was designed to adapt to an evolving environment. For example, one major problem with C++ in a production environment is a side-effect of the way that code is implemented. If company A produces a class library (a library of plug and play components) and company B buys it and uses it in their product, then if A changes its library and distributes a new release, B will almost certainly have to recompile and redistribute their own software. In an environment where the end user gets A and B's software independently (say A is an OS vendor and B is an application vendor) problems can result. </li></ul><ul><li>For example, if A distributes an upgrade to its libraries, then all of the software from B will break. It is possible to avoid this problem in C++, but it is extraordinarily difficult and it effectively means not using any of the language's OO features directly. </li></ul><ul><li>By making these interconnections between modules later, Java completely avoids these problems and makes the use of the object-oriented paradigm much more straightforward. Libraries can freely add new methods and instance variables without any effect on their clients. </li></ul>
  16. 20. How to program JAVA <ul><li>With the compiler, first you translate a program into an inter-mediate language called Java bytecodes—the platform-independent codes interpreted by the interpreter on the Java platform. The interpreter parses and runs each Java bytecode instruction on the computer. Compilation happens just once; interpretation occurs each time the program is executed. </li></ul>
  18. 23. JAVA PLATFORM <ul><li>A platform is the hardware or software environment in which a program runs. We've already mentioned some of the most popular platforms, such as Windows 2000, Linux, Solaris, and MacOS. Most platforms can be described as a combination of the operating system and hardware. The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other, hardware-based platforms. </li></ul>
  19. 24. The Java platform has two Components: <ul><li>The Java V irtual M achine (Java VM) </li></ul><ul><li>The Java A pplication P rogramming I nterface (Java API) </li></ul>
  20. 25. Java V irtual M achine <ul><li>It's the base for the Java platform and is ported onto various hardware-based platforms. </li></ul>
  21. 26. JAVA A PPLICATION P ROGRAMMING I NTERFACE <ul><li>The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets. The Java API is grouped into libraries of related classes and interfaces; these libraries are known as packages . The next section highlights what functionality some of the packages in the Java API provide. </li></ul>
  22. 27. Types of programs written in the Java programming language <ul><li>APPLETS </li></ul><ul><ul><li>An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a page. When you use a Java technology-enabled browser to view a page that contains an applet, the applet's code is transferred to your system and executed by the browser's Java Virtual Machine (JVM). For information and examples on how to include an applet in an HTML page, refer to this description of the  <APPLET>  tag. </li></ul></ul><ul><li>APPLICATIONS </li></ul><ul><li>An application is a standalone program that runs directly on the Java platform. A special kind of application known as a server serves and supports clients on a network. Examples of servers are Web servers, mail servers, and print servers. </li></ul><ul><li>SERVLETS </li></ul><ul><ul><li>Java Servlet technology provides Web developers with a simple, consistent mechanism for extending the functionality of a Web server and for accessing existing business systems. A servlet can almost be thought of as an applet that runs on the server side--without a face. Java servlets make many Web applications possible. </li></ul></ul>
  23. 28. NEW FEATURES IN JAVA <ul><li>Development Tools : The development tools provide everything you'll need for compiling, running, monitoring, debugging, and documenting your applications. As a new developer, the main tools you'll be using are the javac compiler, the java launcher, and the javadoc documentation tool. </li></ul><ul><li>Application Programming Interface (API) : The API provides the core functionality of the Java programming language. It offers a wide array of useful classes ready for use in your own applications. It spans everything from basic objects, to networking and security, to XML generation and database access, and more. The core API is very large; to get an overview of what it contains, consult the Java SE Development Kit 6 (JDKTM 6) documentation . </li></ul><ul><li>Deployment Technologies : The JDK software provides standard mechanisms such as the Java Web Start software and Java Plug-In software for deploying your applications to end users. </li></ul><ul><li>User Interface Toolkits : The Swing and Java 2D toolkits make it possible to create sophisticated Graphical User Interfaces (GUIs). </li></ul><ul><li>Integration Libraries : Integration libraries such as the Java IDL API, JDBCTM API, Java Naming and Directory InterfaceTM (&quot;J.N.D.I.&quot;) API, Java RMI, and Java Remote Method Invocation over Internet Inter-ORB Protocol Technology (Java RMI-IIOP Technology) enable database access and manipulation of remote objects. </li></ul><ul><li>Java Database Connectivity (JDBC™): Provides uniform access to a wide range of relational databases. </li></ul>
  24. 29. COMMENTS <ul><li>/* text */ </li></ul><ul><li>The compiler ignores everything from the opening /* to the closing */. </li></ul><ul><li>/** documentation */ </li></ul><ul><li>This style indicates a documentation comment (doc comment, for short). As with the first kind of comment, the compiler ignores all the text within the comment. The SDK javadoc tool uses doc comments to automatically generate documentation. </li></ul><ul><li>// text </li></ul><ul><li>The compiler ignores everything from the // to the end of the line. </li></ul>
  25. 30. CLASS <ul><li>A class is the basic building block of an object-oriented language, such as the Java programming language. A class is a blueprint that describes the state and the behavior associated with instances of that class. When you instantiate a class, you create an object that has the same states and behaviors as other instances of the same class. The state associated with a class or an object is stored in member variables. The behavior associated with a class or an object is implemented with methods, which are similar to the functions or procedures in procedural languages, such as C. </li></ul><ul><li>class Mammal { . . . //class definition block } </li></ul>
  26. 31. public static void main(String[] args) <ul><li>The main method declaration starts with three modifiers: </li></ul><ul><li>public: Allows any class to call the main method </li></ul><ul><li>static: Means that the main method is associated with the HelloWorldApp class as a whole instead of operating on an instance of the class </li></ul><ul><li>void: Indicates that the main method does not return a value </li></ul>
  27. 32. System class <ul><li>The System class provides system-independent access to system-dependent functionality. One feature provided by the System class is the standard output stream—a place to send text that usually refers to the terminal window in which you invoked the Java interpreter. </li></ul><ul><li>System.out.println(&quot;Hello World!&quot;); </li></ul>
  28. 34. Elements You can write in JAVA All keywords are written as small letters so HUWAG NG MAKULIT !!!
  29. 35. Elements You can write in JAVA
  30. 37. Elements You can write in JAVA
  31. 38. Elements You can write in JAVA
  32. 39. Elements You can write in JAVA