1 The JAVA Application Java Applications are similar to C+ + programs in that they require a MAIN entry point. However, unlike C++ or Visual Basic, Java Applications require everything emanate from a CLASS. We will code examine several Java applications. We will also discuss appropriate coding style and naming conventions
31
Embed
1 The JAVA Application zJava Applications are similar to C++ programs in that they require a MAIN entry point. However, unlike C++ or Visual Basic, Java.
3 zBreakdown of the Java Application: zUse our HelloWorld and other applications handed out as a reference zHINT: write comments on these handouts !!!
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1
The JAVA ApplicationJava Applications are similar to C++
programs in that they require a MAIN entry point. However, unlike C++ or Visual Basic, Java Applications require everything emanate from a CLASS.
We will code examine several Java applications. We will also discuss appropriate coding style and naming conventions
2
GOALS...
To identify ALL of the main parts of a Java Application, Syntax Errors
To code simple applications using the proper Syntax, Style and naming Conventions
To get comfortable with Code Warrior, Java API Document
3
Breakdown of the Java Application:
Use our HelloWorld and other applications handed out as a reference
HINT: write comments on these handouts !!!
4
Comments
// for a line of comment
/* for multiple lines */
5
Java Documentation Comments:
Doc comment --- special type of JAVA comment
A multi line comment starts with /** (insead of /*) & Ends with */
6
Java Documentation Comments:
These comments can be turned into online HTML documentation by the javadoc program
EXAMPLE:/**
* @ author David Farrell* @version 1.0
7
Public Static Void Main:
The main entry point in a Java Application
The first code to execute
Actually, it is a wrapper for the Java Class that is to execute first
The classname that has PSVM MUST match the filename
8
Standard Output Stream:
Used to send output to the console
System.out.println(“Hello World”);
Standard Java API method from the Java.Lang.System class
9
Standard Output Stream:
Static Method (does not require instance of System class)
OPEN UP JAVA DOC AND GO TO java Lang System and look at the out exit gc & sleep methods
10
Class:
The initial class as a wrapper for the entry point to the java application (SPVM)
public class HelloWorld{
11
Class Constructor: The method that gets executed when an instance of a class is createdPublic class Addition{ public Addition( ) // empty constructor { }
static public void main (String args[ ] ) { new Addition( ) ; // calls the class constructor }
}
12
Import:
Brings in the prewritten classes for us to use / leverage in our application