Second Summer 2002
Using a computer program you are somewhat limited in what you can do with the
computer, based on what the program that you're using is offering. Programming (which in effect
also boils down to using a computer program, the Java compiler) gives you more freedom, but the
amount of detail you need to specify increases. Thus, for example, using Word to write a paper
is easy, but you can't use Word to browse the web easily, as with Netscape. Authoring documents
with Netscape is not that easy either, because Netscape is mainly a browser.
But using Java you can write your own browser, or your own word processor, or any other kind of
program you want. The amount of work that you will have to do will be significant though, and the
task of writing a browser or a word-processor will probably be much more difficult than browsing
(or writing in Word) itself. But you have this freedom.
But using Java you can write your own browser, or your own word processor, or any other kind of program you want. The amount of work that you will have to do will be significant though, and the task of writing a browser or a word-processor will probably be much more difficult than browsing (or writing in Word) itself. But you have this freedom.
To keep things short we can safely say that whatever can be programmed in Java is a computer. If it can't be programmed in Java it is at most an appliance.
Memory (permanent or temporary) can store both program code (for the machine to run)
and user data (for the program to work on it). So can most of the registers in the CPU.
The distinction between program code and user data is not that precise, because one
person's program code is someone else's user data. For example, think of your code,
which is processed by the compiler.
To summarize we can say that program code can be looked at as user data. (But
there is some data that is not program code).
To summarize we can say that program code can be looked at as user data. (But there is some data that is not program code).
The monitor and the speakers are output devices. The mouse, keyboard, a microfone, and sometimes the monitor (touch screen) can be input devices. There may well be other non-standard input and output devices.
It is an interpreter: a computer program that runs Java bytecode instructions.
An applet is a small program that has already been compiled to bytecode, and can be downloaded over the network, from a web page. Thus it can run on any machine that visits the web page and downloads it.
Hello.javawhich you wrote with the editor
rt.jarthat contains the runtime library
\escape character in Java character strings.
It gives a second meaning to each of a certain group of characters, when it precedes them in a string literal. The combination of backslash and the character in question is then interpreted in a certain way. For example, to specify a double quote inside a string you need to protect it, such that Java does not look at it as the end of string character. Same with the escape sequences for newline, tab, etc...
Syntax errors are all caught at compile time. Logic errors are difficult to spot, and you only catch them when you obtain unexpected, incorrectly computed results. One avoids logic errors by carefully thinking about the program before starting the implementation, and proving (in a mathematically rigorous way) that for all possible inputs the outputs are correctly computed.
Start with the table: |
Repeat steps 2a, 2b, 2c while the balance is greater than $0.00 |
Read the last number in the month column (let's call it months).
Report that the account will be depleted in |
An object is the real thing, an entity that is otherwise anonymous. An object reference is a (named) location where you keep the address to an object. It is a name for the actual object. For a given object you can have zero or more object references pointing to it.
A class is a factory, or a blueprint. Objects are the gadgets that the factory produces using the blueprint. For example you can play an audio tape with a Sony Walkman (of which there are millions in the world) but you can't do the same with its blueprint (of which there's only one, that model's).
A method is a program, a sequence of instructions, a way of doing things. An object is an entity, an agent, that can contain methods (which is what it does best, just like tiggers).