Re: Java Newbie struggling with threads

From: John C. Bollinger (jobollin_at_indiana.edu)
Date: 06/11/04


Date: Fri, 11 Jun 2004 09:26:57 -0500

Bob Dubery wrote:

> Eventually I realised that the only way to do it was to have a common
> object the threads could report to and which could also report back to
> any other thread. Bingo! That worked well - once I spelled synchronize
> with a 'ze' rather than an 'se' - and then the penny dropped all the
> way. There was no other way for it to work.

No other good way, at least. You've got it.

> Coming back to the original problem that was really solved (for me) by
> re-initialising the passed array. Did that really happen because
> arrays are passed by reference?

Yes. (Well, technically, you are passing its reference by value.)
Array instances are objects like any other; when you "pass an array" you
are actually passing its reference.

Array classes are a bit special, but not so as you would notice 99% of
the time. It is sometimes useful to know that Array classes are all
Cloneable and Serializable, and that they expose their clone() methods
with public access. Because arrays are objects you can pass instances
to any method that takes a parameter of type Object; among the more
useful of these are the various methods of the Collections classes.
(I.e. you can store arrays in Lists, Sets, and Maps.)

John Bollinger
jobollin@indiana.edu



Relevant Pages

  • Re: Array Question.
    ... >placing txt boxes with a reference to the array e.g. arraythen ... >arrayand so on 25 lines of 12 on the report. ... >i thought using an array to create what i neede was the simplest. ... >i need to do is use a cursor like mentioned below and go with that. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: K&R chapter 6.3 Question how to calculate the number of array elements
    ... mean 'terminator'. ... any array element, ... Because 'sizeof' provides the value at compile-time. ... remember that sizeof will only report correct size for */ ...
    (comp.lang.c)
  • Re: Need Help With Pivot/Cross-Tab Query Please/ **Dates Are Not Fixed**
    ... SQL Server MVP ... and loop in the QUERY's SELECT statement that returns the "AS Day1, ... Used another CF array and loop to get the column headers to print the ... variables when outputting the query results to a report, ...
    (microsoft.public.sqlserver.programming)
  • Printing is different from Preview...
    ... I have a complicated report that hides ... an array to accumilate column totals. ... Group Footer with the array value during the Group Footer ...
    (microsoft.public.access.reports)
  • Re: Sending Attachments to recipients
    ... I have an Excel spreadsheet with some vba code to do this. ... creat an array of values for my D/L ... enter subject text: "monthly report" ... "Michael Bauer" wrote: ...
    (microsoft.public.outlook.program_vba)