Download Java Syntax, Java Conventions, CSE 115 Conventions (Part 1) CSE 115 Spring 2006

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Java Syntax, Java Conventions,
CSE 115 Conventions (Part 1)
CSE 115
Spring 2006
January 25 & 27, 2006
I - Java Files
All files that contain Java source code
have a .java extension
Code that has been compiled (using the
compiler javac) will be turned into byte
code and stored in files with a .class
extension
Run the files with the java command to
execute the program.
I – Java Files
The process of creating files is often called
the edit-compile-run cycle as the steps
are:
Create/edit your source code
Compile the code
Run the program to see if it works
If it doesn’t work correctly, go back to step 1
II – Java Syntax
Java is case sensitive (as is UNIX)
The words:
excellent
Excellent
are seen as different by Java
Java is also an extremely consistent
speller.
III – Names of Java Files
Match the names of the classes defined in
those files
Each file contains one (and only one)
class definition
All Java code must exist inside of a class
IV – Identifying the class
Class definitions begin at the word public
and end at a } that matches a { that follows
the name of the class.
public class SomeName {
Between the { } is the Java code
that outlines what the
functionality of the class is.
}
V – Class vs. Object
Class – formal specification (definition)
Object – actual instance
We need to represent properties and
capabilities formally, what programming
constructs do we use to do this?
VI – Where does the program start?
Q: How do you get your program to run in
Eclipse?
Q: What are the two types of Java
programs and what are their differences?
Program starts with the first line of the
Applet’s constructor.