Java Terms - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Java Terms

Description:

Java Application Program program that is stored and run on a user's ... JBuilder by Borland (www.borland.com/) Eclipse Open Source by IBM (www.eclipse.org) ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 21
Provided by: teac160
Category:
Tags: borland | java | javac | terms

less

Transcript and Presenter's Notes

Title: Java Terms


1
Java Terms
  • Middle Tennessee State University
  • Fall, 2005

2
Java Terms
  • Java Application Program program that is stored
    and run on a users local computer.
  • Has a method called main()
  • Stored and run on users local computer
  • May be command-line or GUI interface
  • Java Applet java program that is embedded in a
    Web page.
  • No method called main()
  • Methods are called by browser

3
Java Terms
  • JSDK Java Software Development Kit (also called
    JDK for Java Development Kit)
  • Primitive command-line tool set that includes
    libraries, compiler, interpreter and applet
    viewer for testing Java applets as well as other
    useful utilities
  • IDE Integrated Development Environment
  • Java development package for rapid development of
    Java programs (edit, compile, build, debug)
  • Effort if required to learn how to use
  • JBuilder by Borland (www.borland.com/)
  • Eclipse Open Source by IBM (www.eclipse.org)
  • NetBeans OpenSource by Sun (www.netbeans.org)
  • BlueJ - www.blueJ.org (free download)
  • JGrasp www.jgrasp.com (free download)

4
Java Terms
  • Java Class Library predefined classes
  • Java is a object oriented language
  • Use classes to set up objects
  • Java programs consist of the use of many classes
  • Java APIs Java Application Programming
    Interfaces
  • Collection of existing classes in the Java class
    library

5
Terms - Creating a Java Program
  • Javac Java compiler that translates Java source
    code into bytecode
  • Bytecode is the language that is understood only
    by a Java interpreter
  • Is not machine language for any particular
    computer
  • Language for a fictitious computer called Java
    Virtual Machine
  • Each computer will have its own bytecode
    interpreter
  • Bytecode interpreters are very simple compared to
    a compiler

6
Example - compilation
  • Source file Welcome.java
  • To translate to bytecode javac Welcome.java
  • Result of translation produces a file called
    Welcome.class (bytecode)
  • To execute java Welcome

7
Terms
  • JVM Java virtual machine interpreter for Java
    bytecode
  • appletviewer program used as a debugging aid
    when creating Java applets

8
Terms
  • Package group of related classes pre-defined by
    Java
  • Java class Library set of all packages
  • Core package
  • Name of package begins with java
  • Example the java.lang package

9
Terms
  • Optional packages
  • Name of package begins with javax
  • Example the javax.swing package
  • Many packages are included in JSDK

10
Predefined classes
  • System
  • Class defined in java.lang package
  • String
  • Class defined in the java.lang package
  • JOptionPane
  • Class defined in the javax.swing package
  • Creates dialog boxes

11
Typical Java Environment
  • Phase I Create source program with an editor
    and save with .java extension
  • File name must be the same as the class name
  • Phase 2 Compile using javac
  • Produces bytecode with .class extension
  • Phase 3 Loader puts .class files in memory
  • Phase 4 Bytecode Verifier checks validity of
    bytecode
  • Phase 5 - Interpreter

12
Java Conventions
  • Class names begin with uppercase letter and
    multiple word names are capitalized
  • Example public class Welcome
  • Example public class WelcomeLetter
  • File names must be identical to class name
  • Programs have one public class only.
  • Variables begin with lower case letters

13
Writing a Java Program
  • Two types of programs
  • Application programs
  • Applets
  • Application programs
  • Standalone programs
  • Can be executed from any computer with a Java
    interpreter
  • Applets
  • Special type of java program that can run
    directly from a Java-compatible Web browser

14
Java Application Program
  • Comments
  • //This is a Java comment
  • / This is a Java comment /
  • / this is a Java comment /
  • Preferred method in certain cases
  • / This is best! We will find out why later!/
  • Called a javadoc comment
  • Used for documenting classes, etc

15
Java Modifiers
  • Reserved words that specify properties of data,
    methods, and classes
  • public
  • static
  • private
  • final
  • abstract
  • protected

16
Statements/Blocks/Methods
  • Every Java statement ends with a semicolon.
  • Blocks begin with and end with
  • Method collections of statements that perform a
    sequence of operations
  • Classes normally contain 1 or more methods
  • main Method (required) for Java Applications
  • //form of the main method
  • public static void main (String args)
  • / statements

17
Example 1
  • /
  • The following Java Application program displays
    a welcome message to the standard output.
  • /
  • public class Welcome
  • public static void main (String args)
  • //Display a welcome message
  • System.out.println(Welcome to the world of
    Java!)

18
Example 2
  • public class Welcome
  • public static void main (String args)
  • //Display a welcome message
  • displayMessage()
  • public static void displayMessage()
  • System.out.println(Welcome \n to the world of
    Java!)

19
Good Web Sites
  • http//java.sun.com/j2se/1.5.0/docs/api/overview-s
    ummary.html
  • http//java.sun.com/docs/books/tutorial/java/
  • http//java.sun.com/docs/books/tutorial/java/TOC.h
    tml

20
The End
Write a Comment
User Comments (0)
About PowerShow.com