Last updated by Roedy Green ©1996-1999 Canadian Mind Products.
Stuck in a frame? Click here to break out.
Here is a an analogy you might use for non-programmers: Computer programs are like instruction manuals to tell the computer what to do. In traditional programs, there is one great book containing all the instructions. In OO programming, in the computer's virtual universe, there is an instruction book attached to every object that tells the computer what it can do with each object and how. All Dalmatians come with two instruction books, a care and feeding of Dalmatatians, and a generic care and feeding of Dogs. The Cocker Spaniels come with a specialised care and feeding of Cocker Spaniels book, and the exact same book on care and feeding of Dogs. The instructions in the specific books can override the general instructions or add to the general instructions in the Dog book.
In Java you can create octal literals simply by adding a leading zero like this:
The computer chip works internally in binary (base 2 numbers), with numbers made only of the digits 0 and 1, low voltage/high voltage. Binary numbers are somewhat bulky to write out, so they are usually written in base 16, hex, but sometimes in base 8, octal, e.g. the unix CHMOD command. It is very easy to convert octal to binary and visa versa using the following table. For example, the octal number 750 is 111101000 in binary. Converting between decimal and octal is more difficult. You must do successive divisions and moduluses by 10 or 8.
Decimal | Octal | Binary |
---|---|---|
0 | 0 | 000 |
1 | 1 | 001 |
2 | 2 | 010 |
3 | 3 | 001 |
4 | 4 | 100 |
5 | 5 | 101 |
6 | 6 | 110 |
7 | 7 | 111 |
![]() |
![]() |
![]() | |
![]() |
Canadian Mind Products | You can get an updated copy of this page from http://mindprod.com/jglosso.html | The Mining Company's
Focus on Java Best of the Net Award |