Newsgroups: comp.lang.java.programmer,comp.lang.java.help, comp.lang.java.gui,comp.answers,news.answers
Approved: news-answers-request@MIT.EDU
Subject: Java Programmers FAQ
Followup-To: poster
Summary: This posting answers frequently-asked questions by Java programmers
Supersedes: <6dcvct$ao9$1@shell15.ba.best.com>

Archive-name: computer-lang/java/programmers/faq
Posting-Frequency: twice-weekly
Last-modified: 1998/2/28
URL: http://www.afu.com/javafaq.html
Copyright: (c) 1997,1998 Peter van der Linden
Maintainer: Peter van der Linden

Frequently Asked Questions (with answers) for Java programmers

           _____________________________________________________
  ________|                                                     |________
  \       |   Java Programmers FAQ        http://www.afu.com    |       /
   \      |      Copyright (c) 1997-98 Peter van der Linden     |      /
   /      |_____________________________________________________|      \
  /___________)                                              (__________\

The Java FAQs here are intended for people who already know how to program in some language (not necessarily Java though).

The most up-to-date copy of this FAQ is available at: http://www.afu.com/ in both HTML and text forms. It reflects the latest and most current FCS version of Java: JDK 1.1.5.


Please support Java Portability!

The biggest value of Java is its portability. Portability makes it easier for companies to upgrade operating systems and platforms. Portability makes it easier for Java programmers to transfer job skills to different employers. Microsoft has made unauthorized changes to Java libraries, to undermine portability. Microsoft's unauthorized changes are described by an independent Java users organization at http://www.javalobby.org/action/msjava-diffs.htm and at http://www.netaction.org/msoft/world/.

The contract in which Sun licensed its Java source code to Microsoft requires Microsoft's derivative product to pass the Java compatibility test suite. Sun charges Microsoft with breaking this contract, and is suing Microsoft. The contract clause that Microsoft is alleged to have broken is described at http://www.afu.com/contract.html

Here is a link explaining why Java portability is important. The best way for programmers to support portable Java is to reject non-standard tools. Please avoid Microsoft near-Java tools.

Free standard Java compilers can be downloaded from http://java.sun.com.
Free standard Java Virtual Machines can be downloaded from http://www.kaffe.org. and http://www.redhat.com/linux-info/jolt
Free Java AWT software can be downloaded from http://www.biss-net.com/biss-awt.html and the files are all at ftp.blackdown.org (the linux site) too.
Free Java software can be downloaded from http://www.gnu.org/software/java/java.html


0. A WORD FROM OUR SPONSOR


1. LOOKING FOR INFORMATION
2. COMPILERS, ETC.
3. LANGUAGE ISSUES

4. AWT and Related Topics

5. CORE LIBRARIES
6. I/O
7. NETWORKING & DISTRIBUTED OBJECTS
8. MULTI-MEDIA
9. SECURITY
10. Java IDIOMS
11. FOR C and C++ AFFICIONADOS
12. FURTHER RESOURCES
13. TOP TEN NOVICE PROBLEMS

-------------------------------------------------------------------------

0. A WORD FROM OUR SPONSOR

Learning Java

This Java FAQ is maintained as a service to the Java community. Please consider these books from the FAQ author when you are looking for a programming text. Sample chapters are on Sun Microsystems webpage at http://www.sun.com/971124/cover-linden/.

1. Looking For Information


2. COMPILERS, ETC.


3. LANGUAGE ISSUES

T.java:96: Can't access protected method clone in 
class java.lang.Object.  OtherT is not a subclass of 
the current class.

4. AWT and Related Topics

Math.pow(2,Toolkit.getDefaultToolkit().getColorModel().getPixelSize())

4.1 APPLETS 4.2 BROWSERS 5. CORE LIBRARIES

6. I/O

//class that opens the printer as a file and writes "Hello World" to it
import java.io.*;
public class lpt {
    public static void main (String[] argv) {
        try {
                FileOutputStream os = new FileOutputStream("LPT1");
                            //wrap stream in "friendly" PrintStream
                PrintStream ps = new PrintStream(os);

                            //print text here
                ps.println("Hello world!");

                            //form feed -- this is important
                            //Without the form feed, the text
                            //will simply sit in the print
                            //buffer until something else
                            //gets printed.
                ps.print("\f");
                            //flush buffer and close
                ps.close();
          } catch (Exception e) {
                System.out.println("Exception occurred: " + e);
          }
     }
}
7. NETWORKING & DISTRIBUTED OBJECTS 8. MULTI-MEDIA 9. SECURITY 10. Java IDIOMS 11. FOR C and C++ AFFICIONADOS

12. FURTHER RESOURCES



13.  MOST COMMON JAVA NOVICE PROBLEMS


Acknowledgements

FAQ copyright 1997, 1998 by Peter van der Linden. Contributions and help from:

Matt Kennel, Patric Jonsson, Brad Van Tighem, Tony Hursh , Glenn L Vanderburg, Peter Jones, John McDowall, Jim Driscoll, Uday, Dave Harris, Bill Wilkinson, Tom Valesky, Dan Drake, Giles Thomas, Mitch Baltuch, Guy Ruth Hammond, Gordon Keith, Jason Brome, Shani Kerr, Steve Chapel, Timothy Wolters, Robert Lynch, Jake Cormier, Sean C Sullivan, Joseph A. Millar, Jim Frost, Jim Balter, Jeff Bauer, John Kochmar, Carl Burke, William Stubbs, Mark Smith, Volker Turau, Real Gagnon, Russell Gold, Max Hailperin, Bill Tschumy, Marco Nijdam, Marc Pawlowsky, Laurence Vanhelsuwe,Ian Macgregor, Mike Faulkner, Rich Koch, Will Clark, Govind Seshadri, Rich Simkin, Ian Stiles, Kieren, Darren Christie, Tom Lane, Michael Jungmann, Rob Mayoff, George Ruban, Tom McCann, David Hopwood, Thomas Phan, Kai Stuke, Rolf Howarth, Derek Snider, David Boydston, Andy Godwin, John F. Dumas, Doug Bell, David J. Biesack, Tiger Quimpo, Martin Hugh Rogers, Brian Krahmer, Ian Burrell, Nikki Locke, Bin Li, Jackson Thompson, Steve Odendahl, Greg Smith, Jeffrey C. Ollie, Mark Halvin, Jeremy Cook, Lak Ming Lam, Peter S. Morris, Mark Halvin, Juergen Keil, Alex Stewart, Mike Abney, Rodney Stephenson Mark Gritter, Satish Talim, Tamminen Eero, Alexander Gridnev, Eric Hodges, Jamey Graham, Will Lockhart, Scott Plante, Tom Sanfilippo, Jan Newmarch, Sean Breslin, Stuart D. Gathman, rhino@wwdc.com, C Matthew Curtin, Tor Iver Wilhelmsen, A.N.Pryke, Phil Race, David Holmes, David Rodal, Dominique Plante, Trent Jarvi, Ingrid Biery, Gopal Unni Krishnan, Grant Lewis, Tov Are Jacobsen, Gary McGath, Marty Hall, Will Forster, Colin Mummery, Darin McBride, Mayank Shah, Jens Alfke, Glen Stampoultzis, Philip Brown, Peter Steiner, Kurt Spaugh, Rasmus Ekman


I am maintaining a FAQ list to address specifically programming issues
(not a general tutorial on Java). Please feel free to mail suggestions to me at pvdl@best.com.
Question with answer gets you a credit in the FAQ.
Peter van der Linden, Sun Certified Java Programmer.

-- end --