Download
1 / 25

Introduction to Java - PowerPoint PPT Presentation


  • 67 Views
  • Uploaded on

1. Introduction to Java. History of Java. Java Originally for intelligent consumer-electronic devices Then used for creating Web pages with dynamic content Now also used to: Develop large-scale enterprise applications Enhance WWW server functionality

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Introduction to Java' - jasmine-kaufman


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
1

  • Introduction to Java


History of java
History of Java

  • Java

    • Originally for intelligent consumer-electronic devices

    • Then used for creating Web pages with dynamic content

    • Now also used to:

      • Develop large-scale enterprise applications

      • Enhance WWW server functionality

      • Provide applications for consumer devices (cell phones, etc.)


Java class libraries
Java Class Libraries

  • Classes

    • Include methods that perform tasks

      • Return information after task completion

    • Used to build Java programs

  • Java provides class libraries

    • Known as Java APIs (Application Programming Interfaces)


Fortran cobol pascal and ada
FORTRAN, COBOL, Pascal and Ada

  • FORTRAN

    • FORmula TRANslator

  • COBOL

    • COmmon Business Oriented Language

  • Pascal

    • Structured programming

  • Ada

    • Multitasking


Basic visual basic visual c c and net
BASIC, Visual Basic, Visual C++, C# and .NET

  • BASIC

    • Beginner’s All-Purpose Symbolic Instruction Code

  • .NET

    • .NET platform

  • Visual Basic .NET

    • Based on BASIC

  • Visual C++

    • Based on C++

  • C#

    • Based on C++ and Java


Typical java development environment
Typical Java Development Environment

  • Java programs normally undergo five phases

    • Edit

      • Programmer writes program (and stores program on disk)

    • Compile

      • Compiler creates bytecodes from program

    • Load

      • Class loader stores bytecodes in memory

    • Verify

      • Bytecode Verifier confirms bytecodes do not violate security restrictions

    • Execute

      • JVM translates bytecodes into machine language


Fig 1 1 typical java development environment
Fig. 1.1 Typical Java development environment.


Creating a program with jcreator
Creating a Program with JCreator

  • Click on the JCreator Icon

  • IDE windowappears


Creating a program with jcreator1
Creating a Program with JCreator

  • Click on File, New, then Project

  • Project Wizard appears

    • Choose Java Application template


Creating a program with jcreator2
Creating a Program with JCreator

  • Give the project a name

  • Then click Next


Creating a program with jcreator3

At this point you can click on Finish

Creating a Program with JCreator

  • You will want the JDK version 1.5

  • This tab is where you can specify hsa library


Creating a program with jcreator4

For now, you can proceed with Finish

The Class Wizard appears. Specify a name for the class and make sure Public is chosen

Creating a Program with JCreator

  • Now we create our class (the program) with File, New, and Class


Creating a program with jcreator5
Creating a Program with JCreator

  • The wizard creates a template.

  • Now complete the program with the required commands.


Creating a program with jcreator6

Build Output shows in bottom pane. This is where compiler error messages will be displayed.

Creating a Program with JCreator

  • Run the compiler with Build, and CompileFile


Creating a program with jcreator7
Creating a Program with JCreator error messages will be displayed.

  • To run the compiled program click on Build, and ExecuteFile

  • Program runs in separate window

Without Creating a Project


Programming with ready to program
Programming with error messages will be displayed."Ready to Program"

  • Find the "Ready" option on the program menu or click on the"Ready" icon


Programming with ready to program1
Programming with error messages will be displayed."Ready to Program"

  • An empty editor window appears


Java programs

A Java class with a method called main() is a Java application.

The name of the file and the name of the class must, that is MUST have the same name

Java Programs

  • A Java program consists of one or more classes


Creating a java application
Creating a Java Application error messages will be displayed.

  • The "Ready" environment will give you skeleton or boilerplate format for programs

  • Click on File, New, and HSA Console option

  • A dialog box asksfor the name of the class


Creating a java application1

Bold Face error messages will be displayed. Java keywords

Black Identifiers in Java Class library

GreenComments

BlueIdentifiers in your program

Creating a Java Application

  • The appropriate boilerplate text appears in the edit window – note the color coding

RedQuoted Strings


Creating a java application2

Creating a Java Application

  • Fill in the necessary commands

  • Save theprogram


Creating a java application3
Creating a Java Application error messages will be displayed.

  • To run a Java program

    • Press the Run button or

    • Press Ctrl+R or

    • Press F1

  • The consoleprogram showsa consolewindow


Creating a java application4
Creating a Java Application error messages will be displayed.

  • Make sure to save the program before quitting

    • The "Ready" environment will remind you

  • To exit the "Ready" environment

    • Click the X close or

    • Choose File, Exit or

    • Use Ctrl-Q


Creating a java application5

Dialog box shows how many errors error messages will be displayed.

Description of error given in the status bar

Error line(s) highlighted

Creating a Java Application

  • Errors in the program

    • Syntax errors are found for you by the compiler


Why different ides
Why Different IDEs? error messages will be displayed.

  • Which one you use depends on what you are doing

    • In class the Ready to Program IDE is easy to use, “quick and dirty”

    • But … it does not support JDK 5.0

  • JCreator

    • supports JDK 5.0

  • Eclipse

    • a bit more complicated, but does a bit more

    • found to be a bit balky with some elements of JDK 5.0


ad