Wednesday, September 12, 2007


http://www.sdmf.k12.wi.us/mfhs/java/notes.html
Pg. 24 - 42

*Java programming language allows software to be asily exchanged via the web.

1) Problem Solving : the purpose of writing a program is to solve a problem.
1) Understanding the problem.
2) Breaking the problem down.
3) Designing a solution. (where u write prog.)
4) Considering alternatives to the solution and refining the solution.
5) Implementing the solution.
6) Testing the solution and fixing any problems.

2) The Java programming language
1) A program is written in a particular programming language that uses specific words and symbols to express the problem solution.
2) Program Statements: combination of words and symbols in the program language, which is appropriate according to the rules given.

3) Java developed in early 1990s by James Gosling at Sun Microsystems.
4) Introduced to public in 1995.
*Java got a lot of attention b/c it was the first programming language created for the Web.

5) Java is an Object-oriented programming language.
6) In Java we focus on important issues and not the details.
7) Java has a library of extra software that can be used when developing programs.

3) Java program
1) Comments don’t affect what the program does.
2) Comments are used as guidelines for someone to read and to understand what the code means.
3) Documentation: any written comments or documents, including a user’s guide and technical reference.
4) Inline Documentation: Comments included in a program.

5) Class definition: the code of the program within these braces {code}.
6) All Java programs are defined using class definition.

7) Method: a group of programming statements that are given a name. Like a class definition, a method is also enclosed with braces.
2) All Java programs have methods, and this is where the processing begins.

3) println (pronounced “print line”): we invoke, or call, a method when we want it to execute.
4) The println method prints specified characters to the screen.
5) The characters that are to be printed are represented as a character string, enclosed in double quote characters (“)

4) Comments (in more detail)
1) For single line comment we use (//)
2) For muli-line comments we enclose with (/**/)

5) Identifiers and reserved words.
1) Identifier: the various words used when writing programs. There are three categories.
1) words that we make up. (Harvard, arg)
2) words that another programmer chose (String, system, out)
3) words that are reserved for special purposes in the language. (public, static, void)

2) Identifier arg (short for argument): Instead of Harvard we can use any identifier in its place.
3) The words that another programmer uses are pulled directly from the huge library of predefined codes.
4) Reserved words: identifiers that have a special meaning in a programming language and can only be used in predefined ways.
- (In Java reserved words are in blue type)
*A reserved word cannot be used for any other purpose, such as naming a class or a method.

5) Identifiers may be of any length, they consist of a combo of letters, digits, the underscore character ( _ ), and the dollar sign ($) (identifiers can’t start with a number).
*Java is CASE SENSITIVE (matters when you put in upper-case vs. lower-case)

6) Name: in Java, it is a series of identifiers separated by the dot (period) character.

6) White space
1) consists of blank, tabs, and newline characters
2) All Java programs use white space to separate the words and symbols used in a program.
3) Except when it’s used to separate words, the computer ignores white space.

*empty white space does not affect the execution of the program.

7) Programming languages
- suppose you are giving travel directions to a friend. You might explain those directions in one of several languages. (French, Spanish, English). ***Although you give the same direction the way you express it is different.
1) This is the same for programming languages, such as Java, Ada, C, C++.
2) The purpose of the program is the same no matter which language you use, but the particular statement to express the instructions vary with each language.

8) Programming language levels
Lower-level Languages
1) Machine (computers only read this)
2) Assembly (replaced Binary digits with mnemonic, short English-like words that represent commands or data.)

3) Higher-level (means that the programming statements are like natural language. Ex. Java, Ada, C, C++)
4) Fourth-generation. (4GLs): They are called 4GLs b/c these followed the first three generations of computer programming.

9) Compilers and Interpreters
1) Software tools: special-purpose programs need to help with the process of developing new progs.
2) Editor: you use this to type a program into a computer
3) compiler: a program that translates code in one language to another language.
4) source code: the original code.
5) target language: the language into which it is translated.
6) Interpreter: like a compiler, but translates and executes small segments of the whole.

Compiler and Interpreters work hand in hand.
7) The Java compiler translates Java source code into Java byte code, which is a low-level form something like machine language code.
8) The Java interpreter reads Java byte code and executes it o a specific machine.
9) Another compiler would translate the byte code into a particular machine lang. for execution.

**The diff. b/t Java byte code and true machine language code is that Java byte code is not tied to any particular processor type. This make Java architecture neutral. Works on many types of machines. *only restriction is that there must be a Java compiler and interpreter.

**Java byte code could be compiled into machine code.

10) The Kits
1)SDK or JDK (Software/Java Development Kit): contains several other software tools that may be useful to a programmer.
2) IDE (Integrated Development Environments)
Combines an editor, compiler, and other Java support tools

11) Syntax and semantics
1)

No comments: