On Fri, 20 Jun 2003, Ben Barrett wrote: >So, what is the problem we are really looking at? >There are so many negative sentiments regarding Java, >but I think it has its benefits, and is worth knowing >what it is good for... right tool / right job, after all.
The original problem, as stated to me a couple of years ago, is this: Given two Java objects, a and b, write a function that swaps them, i.e. after executing swap(a, b); a should contain the former contents of b, and b should contain the former contents of a. The point, I think, is to illustrate how pointers are more restricted in Java than in C, and to provide fodder for those who like to complain about the inconvenience of languages that try too hard to protect you from yourself.[*] The task is, of course easy to do in Java: {SomeClass temp = a; a = b; b = temp;} What's hard is writing a Java SUBROUTINE to do it. It has to be a subroutine...i.e. something that looks like this: void swap(Object a, Object b) { // (put your code here) } - Neil Parker [*] See http://catb.org/esr/jargon/html/B/bondage-and-discipline-language.html _______________________________________________ EuG-LUG mailing list [EMAIL PROTECTED] http://mailman.efn.org/cgi-bin/listinfo/eug-lug