1 / 15

A Programmer's Introduction to Java

A Programmer's Introduction to Java. - from a S/370 user. (c) IDMS/SQL News http://www.geocities.com/idmssql. Purpose. There seems to be a wall between the ‘old’ mainframe guys and the new Javaworld The wall is artificially created using buzzwords as the building blocks

Download Presentation

A Programmer's Introduction to Java

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Programmer's Introduction to Java - from a S/370 user (c) IDMS/SQL News http://www.geocities.com/idmssql

  2. Purpose • There seems to be a wall between the ‘old’ mainframe guys and the new Javaworld • The wall is artificially created using buzzwords as the building blocks • Our objective is to remove this wall • Course will focus on where Java approach differs from our traditional programming Java - Introduction (c)http://www.geocities.com/idmssql

  3. Java - Topics • Buzzwords and the Reality • Basic Data Structures in Java • JSDK from Sun • Arrays • OOP Basics, Classes and Methods • Constructor • File Handling -I/O- Data Streams • GUI - AWT and Swing Components • Method Overloading, Polymorphism • Applets • IDEs - Intgrated Development Environments Java - Introduction (c)http://www.geocities.com/idmssql

  4. What is Java? • “Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable, high-performance, multithreaded, dynamic language” --Sun Microsystems • The words have been faithfully copied from the original article by James Gosling (1995) • Simple meant simpler than C++! Gosling never intended to compare with other platforms or languages! Java - Introduction (c)http://www.geocities.com/idmssql

  5. A more realistic definition: • A C++ like OO language that has a readable syntax and acceptable performance designed to run on several modern platforms. • eg: applications servers, web servers, web browser (embedded in), Mobile phones and ordinary Windows applications Java - Introduction (c)http://www.geocities.com/idmssql

  6. Evolution of Java • James Gosling, Arthur Van hoff, Andy Bechtolsheim. The Original Team in Sun • Originally designed to work in appliances • Mutated to a web browser environment (client) • Mutated from there to server software, where it can run on many back-end server platforms without worrying about GUI compatibility problems Java - Introduction (c)http://www.geocities.com/idmssql

  7. Java Syntax • Language syntax itself is simple • Data type declarations, mathematical operations, array definitions , if-else, for loop, do-while etc are not complex • Easier than C++ • Though a few idiosyncracies inherited from C++ Java - Introduction (c)http://www.geocities.com/idmssql

  8. Sample Program /** Hello World in Java */ public class HelloWorld { public static void main (String args[]) { System.out.println("Hello S212 World!"); } // end of method main } // end of class Java - Introduction (c)http://www.geocities.com/idmssql

  9. Mechanics Comments /** * HelloWorld.java */ public class HelloWorld extends Object { public static void main(String arguments[]) // Where the program starts { System.out.println(“Hello World"); // Print out message } } Class name (MUST match file name) Main method (starting point) Line comment Braces ‘{}’ - start & end of class and methods Java - Introduction (c)http://www.geocities.com/idmssql

  10. Classes and Methods We see that Java programs are organized as classes and methods All Java programs start with a class definition Classes contain one or more methods Java - Introduction (c)http://www.geocities.com/idmssql

  11. Compilation Javac - the compiler from Sun HellloWorld.java Source Code suffix HellloWorld.class Byte Code Java Virtual Machine Run time Source code is translated to an intermediate “byte code” The byte code is run in a Java Run Time System which is normally known as JVM = Java Virtual Machine Java - Introduction (c)http://www.geocities.com/idmssql

  12. JSDK – Development Kit • Standard Edition is free - from Sun • Contains compilers like • - Javac - compile • - Java - execute • - appletviewer – run applets • - Javap – dis-assembler • - Javadoc - created html based doc • - Jar – Java Archive Tool (ZIP) • - many smaller tools... Java - Introduction (c)http://www.geocities.com/idmssql

  13. JSDK • Good • Unlike C, others vendors didn’t bother to make their own compilers – one is enough! • Easy to install and run • Documentation available from sun (zip format) • Missing : Sun failed to give a simple editor and test environment; One must go to DOS! And use an editor made by Mr Nobody!!! Java - Introduction (c)http://www.geocities.com/idmssql

  14. Java vs C • Java was designed for a specific purpose • C is a more general purpose closer-to-machine language • Java does not produce machine code; “interpreted” by the Java Run Time (JVM) • C produces executable code (*.exe) which can be run as it is Java - Introduction (c)http://www.geocities.com/idmssql

  15. Recap • Java is an Object Oriented language suitable for Web and Server based Windows applications • Java SDK from Sun gives you the compiler and Runtime for Java • It’s all about classes and methods Java - Introduction (c)http://www.geocities.com/idmssql

More Related