Ivor Horton

Author
+ Follow
since Mar 22, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ivor Horton

Hi Soum,
I think the only way to remember the class libraries is by usage. I suspect no-one can remember the details all the classes - I certainly can't. There are more than 1600 classes and interfaces now. It is therefore essential to have the SDK documentation installed. I find it handy to put a shortcut on the taskbar to the index.html page for the documentation. Then it is instantly accessible when required.
On the new chapters in the latest edition - I'm afraid that is not downloadable from anywhere. I guess the basic reason is that it would be hard to get folks to pay for the book if they could download it for free
21 years ago
Hi Rob,
Your question comes up quite often but unfortunately Wrox Press have not been able to come up with a way to upgrade. If you have any ideas on how this might work you might care to send it to them via http://www.wrox.com.
21 years ago
Nice to hear from you again Matt! I need all the family support I can get. Amazon and Barnes & Noble offer a good to to family... (You don't even have to have the same name )
21 years ago
No, you can create new files and update or overwrite existing files in Java. In an applet you have no access to files other than those in the directory that contains the applet (for icons etc). You can also delete files and directories using the delete() method for a File object.
If you don't want to overwrite an existing file in a Java application, be sure to use the FileOutputStream constructor with two arguments with the second argument (append) specified as true.
21 years ago
It's been a pleasure to be here Cindy. I'll certainly be back from time to time.
Ivor
21 years ago
Hi Asif,
Generally forward compatibility between SDK releases is reasonably assured, but not backwards compatibility. I don't think it would be a good idea to drag bits of the class library from 1.4 back into a previous release. It would be better to move your code to 1.4. If you do need to stay with an earlier release, it would probably be easier to implement your own version of the component. Since you know the interface for the 1.4 version, you should be able to arrange for yours to have the same interface so if you did move the code to 1.4 it could pick up the standard component from there.
21 years ago
Jason,
I haven't tried it but if you have the JarFile object, the getName() method that is inherited from java.util.ZipFile might help.
22 years ago
Hi Sam,
Yes you are right in that Schemas are the direction and they overcome most of the problems of DTDs. However, the XML Schema was only approved as a W3C recommendation in May last year so the JAXP implementation in SDK 1.4 has no provision for processing XML schemas as yet. I'm sure it will be there eventually.
1.4 does include capability for XSLT but I felt this was beyond what I should be putting in an introductory book on Java. I would also have needed to throw something else out of the book to make room for XSLT - and I really couldn't find anything that I felt could be omitted. Maybe smaller type and a magnifying glass is the answer
[ March 28, 2002: Message edited by: Ivor Horton ]
22 years ago
I'm not sure what you would expect your statement:
int[] numbers = new int[];
to mean. Since there is no dimension specified for the array on the RHS, the array cannot be defined. What space should be allocated with this form and what should be stored in it.
Braces are used to enclose a set of values to be stored in an array and to define the dimensions of the array, so your statement:
int[][] numbers = {null, null};
implies you are defining a two-dimensional array based on a one-dimensional set of two elements with the value null. The values between the braces are inconsistent with the type of element to be stored in the array - type int. The dimensionality of the data values(1-dimensional) is inconsistent with the dimensionality of the array type(2-dimensional).
Of course, you can write:
int[][] numbers = {{1,2}, {3,4},{5,6}};
22 years ago
Arathi,
The XML chapters total about 100 pages. They start with the assumption that the reader may not know much about XML so there's a short intro to the basics of XML and DTDs, and a discussion on SAX and DOM. There are a number of relatively simple examples showing how you can parse an XML document using the default parser or intalling a different parser.
The discussion on using DOM uses Sketcher as a platform for showing how you can create an XML document in Java - it uses a DTD for sketches that is also developed in the context of the discussion on DTDs. The Sketcher program is extended to use DOM to export and import sketches as XML.
22 years ago
Bruce,
The 1.4 topics that I included were the ones that in my judgement a beginner would need to know about. Basically these are new I/O for files, reading and writing XML, regular expressions. There are also a lot of smaller incremental changes scattered around the book to things that were already in 1.3. There are many more additions in 1.4 that would be of interest to the experienced Java programmer. These are described at http://java.sun.com/j2se/1.4/docs/relnotes/features.html
22 years ago
Dirk,
It can't work the way you are looking for because of the way things are stored. Take a one-dimensional array:
int[] array = new int[5];
The variable array stores a single reference - this is the address where the array of five integers is stored. The location of the array storing the integers MUST be recorded somewhere as it can't just float around. With a one-dimensional array, the address of the array is stored in the variable, array.
Now consider a two-dimensional array:
int[][] numbers = new int[5][6];
The variable numbers stores the address of an array of five elements. Each element in this array stores the address of an array of six integers. If we did not specify the dimension 5, for the first dimension, how many arrays of six integers should there be? And where would their addresses be stored?
22 years ago
Dan,
No, it isn't any easier that 1.3.
If you are completely new to programming you would be better off with a book that is a little slower paced and covers the fundamental concepts of how computer programs work. You might like to try John Smiley's book. There's a promotion coming up on Javaranch on this.
22 years ago
Arun,
JDBC chapters were removed from the 1.4 edition (along with the chapters on Images & Animation and Sound) to make room for the new stuff on XML, new I/O and Regular Expressions. It is still 1150 pages....
22 years ago
Hi Daniel,
Bitwise operations are not widely used in Java - unless you get into particular kinds of applications that involve using single bits as flags or accessing multiple data items packed into a single 32-bit word. The latter arises quite often with image data since color values are often a combination of 8-bit RGB values in a single word.
22 years ago