Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Java Terms
Middle Tennessee
State University
Fall, 2009
Java Terms
Java Application Program – program that is
stored and run on a user’s local computer.
–
–
–
Has a method called main()
Stored and run on user’s 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
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 is 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)
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
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
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
Terms
JVM – Java virtual machine – interpreter for
Java bytecode
appletviewer – program used as a
debugging aid when creating Java applets
Terms
Package – group of related classes predefined by Java
Java Class Library – composed of many
packages
Core package
–
–
Name of package begins with java
Example: the java.lang package
Terms
Optional packages
–
Example: the javax.swing package
Many packages are included in the Java Class
Library
Java 2 Platform, Standard Edition (Java SE)
– includes the essential compiler, tools,
runtimes, and APIs for writing, deploying, and
running applications & applets
Terms
Java 2 Platform, Enterprise Edition (Java EE)
– provides a component-based approach to
the design, development, assembly, &
deployment of enterprise applications.
Java 2 Platform, Micro Edition (Java ME) –
targets the consumer and embedded market
– used to write Java apps for cell phoned,
smart cards, etc.
Predefined classes
System
–
String
–
Class defined in java.lang package
Class defined in the java.lang package
JOptionPane
–
–
Class defined in the javax.swing package
Creates dialog boxes
Typical Java Environment
Phase I – Create source program with an editor and
save with .java extension
–
Phase 2 – Compile using javac
–
File name must be the same as the class name
Produces bytecode with .class extension
Phase 3 – Loader – puts .class files in memory
Phase 4 – Bytecode Verifier – checks validity of
bytecode
Phase 5 - Interpreter
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
Files have one public class only.
Variables begin with lower case letters
Writing a Java Program
Two types of programs
–
–
Application programs
–
–
Application programs
Applets
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
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
Java Modifiers
Reserved words that specify properties of
data, methods, and classes
–
–
–
–
–
–
public
static
private
final
abstract
protected
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
}
Example 1
/**
*The following Java Application
welcome message to the standard
*/
public class Welcome
{
public static void main (String
{
//Display a welcome message
System.out.println(“Welcome
}
}
program displays a
output.
[] args)
to the world of Java!”);
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!”);
}
}
Good Web Sites
http://java.sun.com/javase/6/docs/api/index.html
http://java.sun.com/docs/books/tutorial/java/
http://java.sun.com/docs/books/tutorial/java/TOC.html
The End