29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that...

14
Aug 9, 20 22 Getting Ready for Java

Transcript of 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that...

Page 1: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

Apr 18, 2023

Getting Ready for Java

Page 2: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

2

What is Java?

Java is a programming language: a language that you can learn to write, and the computer can be made to understand

Java is currently a very popular language Java is a large, powerful language

but it is not simple! Compared to C++, Java is elegant

Page 3: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

3

Declarations, statements, comments

A declaration gives some information to the computer A statement tells the computer to do something

Statements should really be called “commands” Comments are ignored by the computer—they are

explanations of your program for human beings to read

Page 4: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

4

Syntax and semantics

Syntax is the “grammar” of the language The syntax of Java is large, but finite Syntax must be absolutely correct The computer will point out every syntax error Error messages may be helpful or misleading

Semantics is the “meaning” of your program Semantic errors cause your answers to be wrong You may or may not get error messages

Page 5: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

5

Two aspects of Java

Java has syntax and semantics This is where you begin It is possible to learn everything about Java’s syntax and

semantics We will cover most of Java’s syntax and semantics

Java also has “packages” Packages are sort of like vocabulary bundles To be good at Java, you need to learn many packages There are more Java packages than you can ever learn

Page 6: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

6

The programming cycle

ACTIONS:

THINGS:

edit

.javafile

compile run (execute)

input data(optional)

.classfile

ok

results

ok

syntax errors

runtime error

logic errors

ok

Page 7: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

7

Versions of Java

Java 1 Java 1.0: Original, not very good version Java 1.1: Greatly revised and improved

Java 2 Java 1.2: Includes “Swing” Java 1.3: More new packages, no new syntax Java 1.4: Introduces the assert statement

Java 5 Java 1.5: Available as beta; several additions to syntax

Page 8: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

8

Vocabulary I

JRE, Java Runtime Environment This is the software that allows you to run Java programs on

your computer SDK, System Development Kit (previously called JDK,

Java Development Kit) The software that allows you to create and run Java programs

on your computer When you install the SDK, you get a JRE along with it

IDE, Integrated Development Environment A tool that makes it easier to write programs

Page 9: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

9

Vocabulary II

Beta software Software that is new, untested, often buggy

Interface the place where things touch each other the way that distinct things communicate

GUI, Graphical User Interface A way for the computer and the user to communicate via

graphics (pictures) on the screen

Page 10: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

10

BlueJ

BlueJ is an IDE (Integrated Development Environment). It includes an editor, which you use to write your programs a debugger, to help you find your mistakes a viewer, to see the parts of your program an easy way to run Java programs an easy way to view documentation

Page 11: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

11

Elegance

Powerful software can do everything you want to do--for example, Microsoft Word

Complex software is hard to learn and hard to use--for example, Microsoft Word

More power usually means more complexity Elegant software somehow manages to be both

powerful and simple BlueJ is elegant

Page 12: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

12

What You Need

128 MB of RAM (256 MB recommended) 500 MHz Pentium or better

Macintosh: must run Mac OS X Java JDK 1.4.2 or 1.5 (includes JRE) BlueJ 1.3.5 or 2.0

Earlier versions of BlueJ have serious problems If you have an older version, update!

By the way: the SDK and BlueJ are free

Page 13: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

13

Getting Ready

If you plan to use your own computer: Download and install Java JDK (=SDK) 1.5

http://java.sun.com/j2se/1.5.0/download.jsp Find where it says Download J2SE 5.0 RC and click

DOWNLOAD in the JDK column If you have a Macintosh, get Java 1.4.2

http://java.sun.com/j2se/1.4.2/download.html

[Optional, but strongly recommended] Download the Java documentation from the same page

Download and install BlueJ 1.3.5 or newer http://www.bluej.org/

Page 14: 29-Nov-15 Getting Ready for Java. 2 What is Java? Java is a programming language: a language that you can learn to write, and the computer can be made.

14

The End