Java Glossary

Last updated 1998 July 2 by Roedy Green ©1996-1998 Canadian Mind Products.
Stuck in a frame? Click here to break out.

S

sandbox
Java applets run in a womb provided by the web browser that offers them services, and prevents them from doing anything naughty such as file i/o or talking to strangers (servers other than the one the applet was loaded from). The analogy of applets being like children lead to calling the environment they run in the "sandbox". See womb, applet.
saving face
See face saving.
schema
In SQL, schema refers to DDL the Data Definition Language. More generally it refers to the way data are stored in a database, including persistent object databases. There is a wealth of theoretical papers on related problems such as versioning.
scope
Java class variables have four possible levels of visibility to other classes: public, protected, default (sometimes called friendly or package scope), and private. All local variables can be seen only within the block they are declared. There are no global variables. See public, protected, package, private.
script
Instead of typing a long sequence to identify yourself to the computer you call, you teach your computer to do it for you automatically. There is quite a bit more to it than simply recording your keystrokes. You must take into account the timing, all the variations in what the other computer might say to you, and recovering from errors. You will almost certainly need the assistance of a expert to write some scripts for you.
Scriptic
An experimental extension to Java for parallel programming. It simplifies the construction of threaded programs, user interfaces and discrete event simulations. Starting a thread becomes as simple as placing statements between {* and *}. Available from Delftware.
scrollbar
region on the screen the user can scroll vertically or horizontally or both.
SCSI
Small Computer System Interface. A way of hooking up disks, tapes, scanners, cd-roms etc. to a small computer. SCSI shines over IDE when you have a server with many disks running at once, since it allows overlapped operation of many different devices. The other advantage is the ability to hang many devices on the same controller card. There are several flavours of SCSI, with more in the works:

type bits pins async
MHz
sync
MHz
cable
meters
raw
throughput
Mbytes/sec
SCSI 8 50 4 5 6 5
SCSI-2 8 50 8 10 3 10
wide SCSI-2 16 68 8 10 3 20
differential SCSI-2 16 68 8 10 25 20
Fast20 aka Ultra 16 68 8 20 3 40
Actual speed is 1/3 to 2/3 of the theoretical raw speed depending on the mix of controllers and drives. Each device on the SCSI bus must be assigned a unique ID, usually set with jumpers or a thumbwheel, though plug & play is coming along. The controller is always 7. The priority pecking order is 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8.
security
Java has features to prevent applets downloaded off the web from doing any deliberate damage. It also has features to prevent ordinary applications from inadvertently doing damage. One other aspect of security are digital signatures so that you can ensure an applet came unmodified from a reputable source.
semaphore
A classical technique for protecting critical sections of code from being simultaneously executed by more than one thread. A semaphore is a generalisation of a monitor. A monitor allows only one thread to lock an object at once. A semaphore allows N. The process of grabbing a semaphore for semi-exclusive use is called "downing" the semaphore because they are implemented with a countdown integer that decrements for each lock and increments for each unlock. If a semaphore is fully occupied, new threads wanting to use it will wait until some thread releases its lock by "upping". the semaphore. See monitor, mutex, synchronized. For a semaphore to work, the check for full, and the decrement must be done all in one atomic uninterruptible instruction. The JVM monitor instructions provide the needed hardware support to simulate semaphores. See monitor, Condition variable, synchonize.
serial port
hardware to which you may attach a modem, serial printer or other RS-232C device. Java does not currently officially support such a device. Serial port support is coming in the JDK 1.2. You can read up on how it will work in a JavaWord article. Central Data has created the PortIO interface and an implementation for their EtherLite ® serial/parallel cards. The source code is in the public domain to make it easy to port to other hardware or platforms. Solutions Consulting also has a SerialPort class that does not need special hardware. Take a look at Trent Jarvi's RXTX which comes free with source code for Linux, Irix, SunOS, and other Unixes. See the glossary of serial communication terminology. See essay on RS232C, EOS overview, Oberon Software, JavaWorld article. At Gamelan, there is a shareware library by Markus Bauer (from Germany) that does serial comm. Kevin Timm and Mark are working on an WIN/OS2/Linux serialport class.

Finally, Sun themselves have created a Java Communication's API which defines a platform-independent way to do serial port communication. You can get the early-access version from the Java Developer Connection.

serialisation
Java has no way of writing a complete object to a file, or of sending it over a communications channel. It has to be taken apart with application code, and sent as a series of primitives, then reassembled at the other end. It gets most complicated when there are references to other objects inside each object. JDK 1.1 has a scheme called Java Object Serialisation that uses ObjectInputStream and ObjectOutputStream. John Neffenger wrote a simple Streamable interface that works under JDK 1.0. Cynthia Jeness did an excellent presentation at the Java Colorado Software Summit in Keystone on serialisation. Her extensive lecture notes are availble online.
Serialised objects are very large. They contain the UTF-encoded classnames (usually 16-bit length + 7-bit ASCII), each field name, each field type. There is also a 64-bit class serial number. For example, a String type is encoded rather verbosely as as "java.lang.String". Data are in binary, not Unicode or ASCII. There is some cleverness. If a string is referenced several times by an object or by objects it points to, the UTF string literal value appears only once. Similarly the description of the structure of an object appears only once in the ObjectOutputStream, not once per writeObject call.
Serialisation works by depth first recursion. This manages to avoid any forward references in the object stream. Referenced objects are embedded in the middle of the referencing object. There are also backward references encoded as 00 78 xx xx, where xx xx is the relative object number.
While the lack of forward references simplifies decoding, the problem with this scheme is, you can overflow the stack if, for example, you serialized the head of a linked list with 1000 elements. Recursion requires about 50 times as much RAM stack space as the objects you are serialising. Another problem is there are no markers in the stream to warn of user-defined object formats. This means you can't use general purpose tools to examine streams. Tools would have to know the private formats, even to read the standard parts.
If your object A references C, and B also references C, and you write out both A and B, there will be only one copy of C in the object stream, even if C changed between the writeObject calls to write out A and B. You have to use the sledgehammer ObjectOutputStream.reset() which discards all knowledge of the previous stream output (including Class descriptions) to ensure a second copy of C.
You can roll your own serialisation by writing readObject and writeObject to format the raw data contents, or by writing readExternal and writeExternal, that take over the versioning and labelling functions as well. defaultWriteObject has at its disposal a native introspection tool that lets it see even private methods, and reflect to pick out the fields and references. JavaSoft has written a spec on serialisation that you should probably read if you want to do anything fancier than invoke the default writeObject method. See marshal, persistence, I/O.
serialisation
see serialization.
semaphore
A classical technique for protecting critical sections of code from being simultaneously executed by more than one thread. See synchronised, monitor.
servlet
an application designed to run on a server in the womb of a permanently resident CGI mother program written in Java that provides services for it, much the way an applet runs in the womb of a Web browser. You can download the standard servlet extension api. See Jigsaw, JavaHTTPD, ExpressO, Jeeves, Java Web Server, James, Acme, Cascade, CGI, cookie, womb.
session
In dbAnywhere a session refers to the dbAnywhere connection. See connection. See dbAnywhere.
setVisible
setVisible(Boolean) controls whether a component and its children are displayed on the screen. setVisible(false/true)() hides/reveals a component by marking it as invisible/visible, allowing it to be painted again on the next painting cycle. hide() and show() are now deprecated. If the component is not already marked invisible/visible, show calls invalidate() which invalidates the component and the chain of parents since there is now more/less screen real estate in the parent container and the positions of the siblings must be adjusted to (flow into the freed space)/(squeeze in this new component). setVisible has no effect on the visible flags of the children. Unlike some GUI programming systems, when you parent.setVisible(true) you don't disturb any of the children's visible = false flags, and the hidden children will stay hidden, even when you again reveal the parent. While you are composing a Frame you usually would temporarily setVisible(false), waiting until all the components are added, before allowing any validate/repaints to be triggered, then setVisible(true) when you were ready for your masterwork to be revealed. setVisible will schedule a repaint if the status changed from invisible to visible. When they are first created, Windows, Panels and Frames are invisible and other components are visible. See also repaint, validate, invalidate, hide, show.
shadow
When a subclass has a variable by the same name as one of its superclasses we call that shadowing. Be warned. The rules for inheritance for variables are quite different than for methods. Be careful. The rules for figuring out exactly which version of a variable get invoked are baroque. See also override, overload.
shBoom
a 32 bit dual-stack microprocessor closer to the JVM virtual machine than most microprocessors. It uses the same sort of postfix stack operands. Chuck Moore, the creator of Forth, designed the shBoom chip.
ShellSort
Basically, you have a list of numbers to sort, and a set of separation distances: a1, a2, ... an, where ai > a(i+1). First you compare pairs of numbers a1 apart and swap as necessary. Then, you compare pairs a2 apart, swapping as necessary, etc. until you compare and swap immediately adjacent values. The efficiency of the sort will of course depend on a good choice for the values a1 through an.
Shockwave
Macromedia's applet plug in for Netscape. It is a competitor to Java.
shopping cart
software for online shopping on the internet such as Giaco's. Rodney Myer also did one in JavaScript. See WebShop.
show
Show unhides a component by marking it as visible, allowing it to be painted again on the next painting cycle. "show" is deprecated. With JDK 1.1 you are supposed to use setVisible(true); See setVisible, hide.
shroud
To mechanically replace all variable and method names with random meaningless names. This makes it harder to reverse engineer class files. You can use free mangler part of the EspressoGrinder compiler, with the option "-obfuscate". Some work on the source code, and others on the class files. See Creama, Jobe, JavaCC, HoseMocha, HashJava, Monmouth, JShrink, klassMaster, ObfuscatePro, Visblock, decompile, disassemble.
sigh
A word used in comp.lang.java.* Internet postings as the ultimate insult. One addicted to use of the sigh insult is under the delusion that others disagree with him only because others are too stupid to understand his deathless prose. see yawn.
signature
Java has a way of compactly encoding the types of each parameter and the return type on a given method. This string is called the method's "signature".
signed applets
A technique of adding a digital signature to an applet to prove that it came from a particular trusted author. Signed applets can be given more priviledges that ordinary applets. See Daniel Griscom's FAQ or Ted Landry's FAQ on signing. For this to work there needs to be a chain of trusted authorities and automatic verification of public keys with those authorities. Any boob can create a signed applet with some valid signature. Further, even a trusted author can write buggy code. See my essay based on Steven C. Den Beste's work.
single dispatch
The OO term for overriding, allowing different methods to be used depending on the type of a single object. See multiple dispatch.
singleton
Singletons are the design pattern when you want only one instance of a class created. You make the constructor private, and give access to the instatianted object via a static instance method that creates the object if it has not been created already. The advantages of this technique over using class variables and methods are: See design pattern
sizeof
Java does not have a sizeof like that in C/C++. All primitive types have a standard size, so you don't really need one. There are no pad alignment bytes.
type size
in
bytes
boolean 1
byte 1
char 2
short 2
int 4
long 8
float 4
double 8
object reference 4
return address 4
slick edit
A $300US visual editor for Java that tidies source code. I use it. I like it. I just wish it were cheaper so more people would enjoy it.
SLIP
Serial Line Interface Protocol. Protocol for dialling up an Internet provider. It lets you simultaneously browse remote machines while file transfers go on in the background. It is being supplanted by the more internally complex, but easier to use, PPP.
SMTP
Simple Mail Transfer Protocol. The protocol most commonly used for sending mail to a server. There is an undocumented class for sending mail: sun.net.smtp. You use it like this:
SmtpClient c = new SmtpClient(server);
c.from(sender);
c.to(recipient);
PrintStream p = c.startMessage();
p.println( "" );
p.println( "Subject: Test of SMTP Server" );
p.println( "" );
p.println( "Hi" );
c.closeServer();

See POP3, JavaMail, GoodHost, MassMail, Hacksaw.
SNMP
Simple Network Management Protocol. See Alex Kowalenko's implementation.
socket
In TCP/IP each computer has a name, such as roedy.mindprod.com. However, various TCP/IPprograms could be running on that computer. Each gets a assigned a number called a socket. The HTTP server would usually be assigned 80. DbAnywhere is usually 8889. This way you can specify which service on the local or remote machine you want to connect with. The socket is specified like this: roedy.mindprod.com:8889.
solver
a program such as the ILOG Solver, that seeks the optimal solution to a problem given constraints. The C++ based ILOG Solver is aimed at job shop and flow shop scheduling, transportation and logistics planning, timetabling, predictive personnel policy management, staff allocation and rostering, configuration, placement, network routing and frequency allocation. Such problems often involve complex constraints and extremely large search spaces. See global optimisation.
SOM
System Object Model ?? IBM's technique for objects to communicate with each other. See ORB.
sort
Putting items in ascending or descending order by key fields. The English language meaning of sort is simply to categorise, e.g. to put all your bills into folders by category, e.g. all the electric bills together, all the phone bills together. An internal sort is done strictly in RAM. An external sort uses hard disk temporary files. Here are some sorts: Tamfana, NIST, CSUSB. I wrote three sorts avaliable with source: see HeapSort, QuickSort, RadixSort, ShellSort.
sound
Here are some places where you can find canned sounds: Wavplace, SoundAmerica, pcug, or Cybercinema. see AU, beep, JMF, wav, IMF, MIDI, Soundbite, sound-on-the-fly.
Soundbite
A program to record sounds from within Netscape Navigator.
SourceAgain
A decompiler. See decompiler, disassembler.
Source Collections
See Collections of Source.
space
"Space" is modem jargon for "a binary zero". In the days of the telegraph, Morse used an on/off one/zero code. Pens at the receiving end made marks and spaces on a moving piece of paper. Sending a one made a mark. Sending a zero made a space. Though we now use ASCII, a simpler and less efficient code that Morse's, we still use the old terminology.
SPAM
Monty Python did a skit where they said the word "SPAM" so many times you wanted to run screaming from the room. SPAM is either junk e-mail or junk postings in a newsgroup. Typically it is an advertisement for some product or scam totally unrelated to the newsgroup, e.g. pornography in the comp.lang.java newsgroups. People try various tactics to avoid getting on the spammer's hit lists. For the most part they just annoy or block legitimate correspondents. Eventually we will invent legal or technical countermeasures, but for now it is just a fact of life like mosquitos on a camping trip.
SPASM
Stolen Postfix ASseMbler. Roedy Green's rip off of the Laxen and Perry 16-bit Postfix assembler for 32-bit operations on the Intel 8086 and follow on chips that emulate it part of the BBL Forth compiler. See BBL, ORGASM.
sponsor
Somebody who not only refrains from using free coupons to the movies, but also who buys tickets for all her friends.
springs and struts
Vibe's replacement technique for layouts that automatically adjusts the size and position of the components to fit the amount of screen real estate provided. Instead of writing code, you visually connect components with fixed length struts, natural length struts and variable length springs. Natural sizes are important because they define what the width and height naturally are for a widget as well as the minimum distance between widgets. For example, on Windows 95 the natural size of a button is 75x23 while on Motif it is 80x25. By using a natural size, the developer does not have to worry about such details. Fixed length struts can be used to control absolute positioning and also the minimum size of various components. See Vibe.
sprintf
See printf.
SQL
Standard Query Language, a platform independent relational database query language. Accessed via JDBC in Java. I have collected a list of SQL vendors including prices. You request sets of records with statements like this to show just the name, city and state of people in Massachussets.
SELECT last_name, first_name, city, state
FROM contacts
WHERE state = 'MA'
ORDER BY last_name;
There is some slick syntax like BETWEEN and IN for writing terser WHERE clauses. You can also summarise data with queries like this to get the count of people in each state (not bothering with states with one or fewer people.)
SELECT state, count(*)
FROM contacts
WHERE age > 18
GROUP BY state
HAVING COUNT(*) > 1
ORDER BY state;
There is some slick syntax like BETWEEN and IN for writing terser WHERE clauses. LIKE "Mc%" gives you wildcard matching.
To change individual fields is a bit tedious. You must compose ASCII sentences. You can't just hand over the modified record in binary. You must tell it precisely which fields changed and how to find the record that needs changing again.
UPDATE contacts
SET last_name='Brown', state='WA'
WHERE acct=2103 AND state='MA';
By adding AND state="MA" you ensure no recent changes have been made by someone else. The syntax for adding new records is quite different from that for updating. If you left off the WHERE clause, every record in the table would be updated!
INSERT INTO contacts(last_name, first_name, city, state)
VALUES('Brown','James','Seattle','WA');
With INSERT, you have to supply all the must enter fields. For bulk insertions, there is the LOAD TABLE command that accepts a file of comma and apostrophe delimited data.
LOAD INTO TABLE contacts FROM 'C:\temp\contacts.txt'
Delete is straightforward. Be careful. If you forget the WHERE clause, every record in the table will be deleted!
DELETE FROM contacts
WHERE acct=2103;
SQL looks quite simple, but is suprisingly powerful. It will let you look up by fields which are not indexed. It will let you change the primary key in a record. It will let you change individual fields in a record without disturbing the others. SQL has its own procedural language to write triggers, code that is automatically run before or after various database events. SQL uses quite different string literal conventions from Java. Strings are surrounded in (') not ("). Embedded (') are written ('') not (\') and embedded (") are left plain as ("). These conventions also apply to data imported into SQL as comma-delimited Strings. SQL uses = both for assignment and comparsion unlike Java with uses = for assignment and == for comparison. If you load your triggers individually they work. If you try to load them in batches, SQL gets confused about terminating semicolons. You can view your triggers with
SELECT * FROM SYS.SYSTRIGGERS; SQL uses CASE/WHEN/ELSE instead of SWITCH/CASE/DEFAULT. Its these little differences that often trip you up and leave you scratching your head. See foreign key, JDBC, ODBC, JSQL, Jeevan.
SSI
Server Side Includes. A technique that makes it much easier to maintain boilerplate text that appears in many different web pages. With the Apache server, if you turn server side includes on, and name your documents *.shtml instead of *.html you can embed code like this in your HTML:
  <!--#include virtual="/includes/copyright.txt"-->
On an NT server, the filename needs to be *.stm instead of *.htm, the syntax is nearly identical:
  <!--#include file="/includes/assoc.htm"-->
Essentially the difference is in the assumptions that each system makes as to what the root level is. On the UNIX system if you use "file=" it starts at the root of the system's filesystem, in NT it starts at the root of the logical server's filesystem.

St

start
method that restarts your applet after a stop, especially animations. In contrast with init, start may be called many times in the life of an applet. start is also run after the init. See also init, stop, main.
start bit
Modems send letters of the alphabet as series of eight zeroes and ones. The modem always precedes each character with a zero. The transition to zero helps resynchronize the clock of the receiving modem so it can sample at the exact centre of each incoming bit. Modems idle by sending ones (marking). The zero (space) bit signifies the start of a character. For more information on start bits see the essay on essay on RS232C.
state
See design patterns.
Statement
In JDBC, you can pass an SQL query or command in a "Statement" object. A "PreparedStatement" object is a Statement that also supports passing parameters to the query. A "CallableStatement" is a PreparedStatement that also supports retrieving output parameters back from the query.
static
Refers to a method or variable that is not attached to a particular object, but rather to the class as a whole. Static final is Javanese for "constant". Static methods work without any this object. Static methods are limited to calling other static methods in the class and to using only static instance variables. They can call instance methods only if they use their own objects -- not rely on this. See constant, class variable, class method, instance variable, instance method.
Stingray Software
makers of a library of tree and grid controls.
STL
Standard Template Library. A library of C++ container classes based on red-black trees. Soon something equivalent should exist for Java.
stoked
excited
stop
method that temporarily shuts down your applet -- particularly animations. See also start, exit.
stop bit
In the old days of the Teletype, modems had to idle while the mechanical print cylinder shifted to the next position ready to type. The modem appended one or two ones on the end of each character to mark time. Today modems still tack on at least one stop bit, but for a different reason. The one bit ensures there will be a noticeable difference (transition from one to zero) when the zero start bit for the next character is sent. For more information on stop bits see the essay on RS232C.
strategy
See design patterns.
StreamTokenizer
java.io.StreamTokenizer breaks up the ASCII text in a file into chunks at delimiters and hands them to you one at a time, preconverted to a binary double for numericas. See this StreamTokenizer code example. Watch the American spelling. See StringTokenizer.
StreamWorks
A scheme like ReadAudio to allow a radio station to broadcast digitally to the planet using the Internet. See RealAudio.
String
Strings are quite different from C++. You can't change the characters in a string. To look at individual characters, you need to use charAt(). Strings in Java are 16-bit unicode. To edit strings, you need to use a StringBuffer object. For manipulating 8-bit characters, you want an array of bytes -- byte[]. See stringWidth.
StringTokenizer
java.util.StringTokenizer breaks up Strings into chunks at delimiters and hands them to you one at a time. See this StringTokenizer code example. Watch the American spelling. See StreamTokenizer.
stringWidth
You can't talk about the length of a string in pixels without specifying the font. To calculate the string's width you need code something like this:
Font font = getFont();
FontMetrics metrics = getFontMetrics(font);
int width = metrics.stringWidth(theString);
structs and springs
See springs and struts, Vibe.
StructureBuilder
A code generating tool written in 100% pure Java that lets you edit code either as source or visually, and the other representation automatically changes to match. $495.
Styx
AT&T/Lucent's new communication protocol. See Dis, Inferno, Limbo, Plan 9.
subclass
You create a new Dalmatian subclass by deriving it from (i.e. extending) a base/superclass Dog. Even though the subclass Dalmatian typically has more methods in it than the original Dog base/super class, we still call Dalmatian a subclass of Dog.
subroutine
In Java functions that return nothing are called "void methods".
substr
String.substr(int start, int end) is Java's way of making a copy of a piece of a string. Java is different from most other languages in that you specify the end point, not the length of the substring. The offsets are 0-based, i.e. the first character of the string is character 0. To further confuse you, the end points one character past the end of the string. It is perhaps best to think of it this way. Imagine little vertical bars separating the characters of the string, with a bar on the beginning and end of the string as well. You feed substr the start and end vertical bar numbers that enclose the substring you want.
_0_1_2_3_4_
|h|e|l|l|o|
0_1_2_3_4_5
"hello".substr(1,3) == "el"
Substr is clever. It does not make a deep copy of the substring the way most languages do. It just creates a pointer into the original immutable string. This can be confusing if you are low-level debugging since you will see the whole string. There have been reports of a bug in Microsoft's implementation of substr.
Sumatra Satellite
a data retrieval tool for accounting information. Runs standalone or in a browser and over the internet if you want. I mention this app because it has a polish not normally seen in Java.
Sun
The company that started Java off. Now child companies SunSoft and JavaSoft are carrying on the work. There are a set of undocumented classes, sun.*, that include FocusingTextField, HorizBagLayout, OrientableFlowLayout, Base64, uuEncode, CRC16, FIFO and LIFO queues, Sort, Timer, FTPClient. NttpClient, SmtpClient, HttpClient, plus dozens more.
Sunsite
A web site at any of a number of universities sponsored by Sun Microsystems.
SunSoft
The business unit of Sun Microsystems that has the charter for technologies using Java or targeting the Java marketplace, like the Java WorkShop development environment.
super
When you override a method, you can still get the original method by using super.ThatMethod(). You can only go back one level.
Super Highway
a proposed network of high speed dedicated phone links that will transmit at 625,000,000 bits per second.
superclass
You derive a new subclass Dalmatian from the base/super class Dog. Even though Dog typically has fewer accessible methods than Dalmatian, we still call Dog the superclass.
SuperCede
Asymetrix's flash JVM compiler for Windows-95. It caches the native code for reuse rather than freshly compiling it each time the class is loaded the way a JIT does. SuperCede also includes a RAD IDE. Coming versions will support Active X and database.
Swift
Swift is an equation editor and viewer written in Java. It is meant to be used to place equations in HTML pages. The viewer is written as an applet and it is used to view the equation. The editor is written as a Java application and runs standalone. It has a GUI along the lines of the Microsoft Equation Editor in Word.
Swing
Sun's set of lightweight GUI components that give much fancier screen displays than the raw AWT. Since they are written in pure Java, they run the same on all platforms, unlike the AWT. They are part of the JFC. They support pluggable look and feel -- not by using the native platform's facilities but by roughly emulating them. This means you can get any supported look and feel on any platform. The disadvantage of lightweight components is slower execution. The advantage is uniform behaviour on all platforms. See AFC, IFC, JFC.
Symantec
The makers of Café a Java IDE. Visual Café adds a visual layout tool to write code. Pro and Database edition include SQL database functionality. See Visual Café Pro, Visual Café Database Development Edition.
SymMath
Class library, provides classes for symbolic derivation and evaluation of a mathematical expression.
synchronized
a crucial method that must not be executed by two threads simultaneously. Note the American spelling that all Java terms use. According to David Holmes, a synchronized non-static method locks the object to which the method belongs, on entry to the method and unlocks it on exit (well if it already owns the lock - they are reentrant - it actually increases and decreases the lock count respectively). A statement: synchronized(foo){ ... } locks the object foo on entry to the statement and unlocks it on exit (or increases/decreases the count if its already owned). A synchronized non-static method is syntactic shorthand for enclosing the whole body of the method in synchronized(this){ ... }.

Only one thread at a time can own the lock for any given object. Thus if more than one thread tries to enter a section of code for which the lock must be acquired then only one thread will get the lock and all other threads will block. Note however that a thread can still execute a non-synchronized method or block of code even if the object is locked.

To protect access to static variables you must lock the class object - which is what a synchronized static method does. Alternatively in any method you can obtain a lock on the class object explicitly using synchronised(getClass()){ ... }

When multiple threads are waiting to acquire the lock on an object the order in which the lock is assigned to a waiting thread is not defined.

See monitor, mutex, semaphore.

synchronous
Serious high speed data transfers use synchronous modems. These send whole messages at a time. This way the overhead of start and stop bits can be dispensed with. Instead a few synchronizing characters are glued to the front of each message to help synchronize the clocks of the two modems. In addition synchronizing characters or special bit patterns are inserted in the middle of messages from time to time. They use patterns that could never represent data.
syntax
I have composed a cheat sheet summarising the Java syntax. The syntax is the grammar of the Java language, where you put your () {} and other punctuation.
system properties
see properties.




HTML Checked! award
Canadian Mind Products The Mining Company's
Focus on Java
Best of the Net Award
You can get an updated copy of this page from http://mindprod.com/jglosss.html