These are my personal class notes for Java
Programming CIS 219
with professor James Habermas at G.C.C. These are MY notes and
NOT a tutorial..Anyone who wishes to use them is welcome. I will try
to
keep the information as correct as possible.
Homework
assignment 01-21-03
1. Set up J2sdk
and TextPad
2. Read appendix A
3. Read chapter 1 1-10 and be able to explain the difference
between an interpreter and a compiler
Important
web addresses
Syllabus
Class
discussion
1. Encapsulate- To enclose in or as if in a capsule. In Java Programming
the main can't touch a private class because it is encapsulated.
2. It is very important to remember Java is CaSe SeNsiTive.
3. public static void is part of all
programs
4. ALWAYS name your java file whatever you call your class
i.e.public class addit then you must
save the file as addit.java
5. Be sure to line up all curly Qs ( {} )
6. Complete statements end with a statement
terminator ; (semi-colon)
7. Literal strings are always in double quotes "
Strings are also known as arguments
8. Java is a
WORA programming
language
Write
Once
Run
Anywhere
9.Writing comments in Java
// single line comment
/*
*/ block commenting
Homework
assignment 01-23-03
1. Work on writing small programs (4 to 6 programs
over the weekend).
2. Get used to using the information posted above and be able to write
a small program without looking at another one.
Class
discussion
1. The source code
is the program the auther creates in a high
level
language such as Java and has a .java
extension.
2. When compiling a source code NO
NEWS IS GOOD NEWS
When compiling in Dos or on a Linux box you
should end up at
the same prompt you start the complie at. i.e. C:\>
3. Compiling in Dos or Linux you must have the .java
extension
i.e.javac your_program_name.java
4. javac compiles into byte code.
5. Byte code is a WORA code
6. To RUN the program after it is compiled you
type:
java your_program_name without
an extension.
7. the symbol .* (wild card) typed after
a file name in Dos or Linux will return
all files with that name i.e. dir day01.* will return day01.java,
day01.class
if you have compiled the .java file
8. Java is platform
independant which means it will run on
any machine that
has the JVM (Java Virtual Machine) installed.
9. Syntax are the rules of a high-level
programming language.
10. Writing a class
gives you the ability to create your own data
types.
11.There are 8 primitive
data types associated with Java.They are;
INTEGER VARIABLES
byte
(8 bit) Stores
an integer in the range -128 to +127
short
(16 bit) Stores
an integer...
int
(32 bit)
Stores
an integer...
long
(64 bit) Stores
an integer...
REAL
NUMBERS
float (32 bit) Single-precision
floating point
double
(64 bit) Double-precision
floating point
OTHER TYPES
boolean Stores True or false value
char (16 bit) Stores
a single character
These primitive types can be used by
themselves or
to create complex data types called reference
types.
Homework
assignment 01-28-03
1. Read chapter 2 Java Programming second edition
Joyce Farrell
Class
discussion
1.Two types of Java Programs
a. Applications
are stand alone programs that run in a Dos window or on a
Linux box.
b. Applets run on the web in a web browser
such as Internet Explorer or
Netscape Navigator.
2. Your browser must be configured to run Java
applets on the web. To do
this you must open a browser window go to Tools \ internet options
\ advanced
and scroll down to Java (Sun) and make sure
the box is checked to run applets
using Java(Sun) instead of Microsoft VM.
Then YOU MUST RESTART YOUR COMPUTER
for the changes to take effect.
3. Syntax errors
are usually spelling errors.
4. Logic errors are usually math errors
5. An integer (int), which is a primitive
data type, reserves four (4) bytes of
ram for storage. Each byte has eight (8) bits
of information.
6. Avoid using reserved words (pg 9)
for naming classes or variables.
7. When writing
classes your variable must be defined and the data type
you choose should be capitalized. For instance, if you needed a variable
for a timer you might use clockTimer
for the variable and the and the data type
might me Timer You would write it like
this: Timer clockTimer;
8. Classes are reusable and must me stored in
your classes folder in
j2sdk1.4.0 \ classes so they are recognized
by the javac.exe when
you reuse them.
Homework
assignment 01-30-03
1. Work on writing programs
Class
discussion
1.Review from Tuesday class discussion.
2. Primitive
data types actually store the
information in RAM
3. Primative data types are just numbers or characters that can be
compared
4. Complex
data types called reference types that
use relative addressing.
Classes relate to relative addressing.
When using a class the memory
ADDRESS
where the the information is stored in RAM is stored first.
5. Some common symbols
char data types use single quotes i.e. 'G'
== is equal or
comparison
= is assignment
\n is a character
\t is a tab
! is NOT
6. newString tells the computer to find
enough memory to store the information.
Homework
assignment 02-04-03
1. Resolve problems 9, 12, and 13 on page 52
Class
discussion
1. Java ia a free format
programming language. This means the entire program
could be writtten on one line or can be written on multipul lines
as long as
statements end with a semi colon (;).
2. /*Commenting out blocks of the program
can be used to debug. By commenting
out sections of code and compiling it will tell you what section is
causing the
program not to compile correctly. This paragraph is commented out.*/
3. A defined name is called an identifier.
4. Cast converts one type of variable to another.
Homework
assignment 02-06-03
1. Understand how to resolve all the problems
at the end of chapter 2
Class
discussion
1. Review from Tuesday
2. How to map
the public drive on GCC's server.
coming soon
3. The 3 basic
parts of a program are:
Input variable definitions and what the
user types into the program.
double p = 1000 //principal
double r = //rate
double t = 10
//time
Process How the problem is resolved.
X = p* r * t
Output The resolution
to the problem.
System.out.println( );
4. Concatination
is to join
Homework
assignment 02-11-03
1. Resolve the Case Project on page 53
Class
discussion
1. An escape quote \"Gary\" is used
to print a quote out within a
literal string.
2.
More
to come
Homework
assignment 02-13-03
1. Resolve 10 of the 11 problems on handout. Due 02-20-03 Source code
printed
out with screenshot (alt-printscreen) of each program and 1 cover
sheet.
Class
discussion
1.Indirect referencing
returns an address of where data is being stored.
2. new
checks to see if there is enough space in RAM to store the data and
reserves the space with an address of where the data will be stored.
3. null
will be returned if enough space in RAM IS NOT found.
4. A method is a verb and can not be
called without a noun in front of it.
i.e. get_input.readLineDouble
Homework
assignment 02-18-03
1. Read pages 279-281, 285-300, 302-305, and anything else found about
init
Class
discussion
1. TEST
Homework
assignment 02-20-03
1. Get SSH set up in class and at home so a connection to GCCs server
can
be accomplished from home.
Class
discussion
1. Cover all documentation on SSH and make key
to access server from
a computer outside the firewall.
Homework
assignment 02-25-03
1. Chapter 9 Applets
2. We will meet in D203 on Tuesday March 04-03
Class
discussion
1. In an applet init()
replaces the main
2. In an applet everything is a string and must be converted.
Homework
assignment 02-27-03
1. Convert one od the 10 programs into an applet.
2. Learn basic Linux commands and practice working in Linux box.
Class
discussion
1. More to come
Homework
assignment 03-04-03
1. Familiarize yourself with moving around in the Linux operating
system.
2. Learn common Linux commands
3. Learn common commands for vim text
editor
4. Common vim commands and tutorials can be found at VIM
Class
discussion
1. Common
Linux commands Other command pages can be found on
the resource page within this website.
2. Any time you want to get to your home directory you can type cp
or cp~
3. In the Linux system you must mount and unmount external drives
such
as a floppy or Zip drive. The command for this is
mount/mnt/zip and unmount/mnt/zip
4. To change your password on Linux yppasswd
Homework
assignment 03-06-03
1. Start reading chapter 3
Class
discussion
1.Relative and absolute paths
2. A relative path is related to where you are currently located in
your directory. a relative command would look something like this
cd ../whitegt/javafiles
3. An absolute path may look like this
cd /home/whitegt/javafiles
4. Calling methods outside the main from within
the main.
More to come on this subject