Nicht aus der Schweiz? Besuchen Sie lehmanns.de
Just Java 2 - Peter Van Der Linden

Just Java 2

Media-Kombination
1136 Seiten
2002 | 5th edition
Prentice Hall
978-0-13-032072-8 (ISBN)
CHF 79,95 inkl. MwSt
zur Neuauflage
  • Titel erscheint in neuer Auflage
  • Artikel merken
Zu diesem Artikel existiert eine Nachauflage
A comprehensive guide to getting started with the Java 2 platform for experienced programmers. Completely updated to include server-side topics, servlets, JSP, XML and more. Covers the latest features & functions incorporated into the JDK 1.4 release.
Peter van der Linden's best-selling Just Java has helped thousands of experienced programmers get off to a flying start with Java. Now, it's better than ever. Fully updated for Java 2 JDK 1.3, it's the only concise guide to both the core Java language and the fundamentals of Java server-side programming! Just Java, Fifth Edition organizes Java into five areas: the core language; key libraries such as I/O, networking, and collections; server-side Java; client-side Java; and enterprise Java. Peter van der Linden presents a "straight-to-the-point" introduction to Java object-oriented programming; then covers the crucial information developers need to build working code right away. The second half of the book covers key server-side libraries and programming techniques, including sockets, servlets, JSP, XML, Java database access with JDBC, JavaBeans, and security.
The accompanying CD-ROM brings together an extraordinary collection of Java developers' resources: an open-source relational database, the Usenet Java Programmers FAQ and Glossary, a complete servlet system and database inquiry program, sample Java games, links to the Web's best Java resources, and all the book's code examples.

PETER VAN DER LINDEN worked at Sun for 14 years in various software engineering capacities in the compiler and OS kernel groups. He currently works for a start-up venture in Silicon Valley. His books include Not Just Java, Expert C Programming: Deep C Secrets (Sun Microsystems Press), and The Official Handbook of Practical Jokes (NAL-Penguin).

Acknowledgments.


Using the Just Java CD-ROM.


About the CD-ROM.


Running the Java Tools.
PART ONE: LANGUAGE.

1. What Is Java?


Compiling and Executing a Sample Program. The Biggest Java Benefit: Future-Proofing. Why Software Portability Matters. J2EE, J2ME, J2SE Editions. Java Virtual Machine. The “Java Platform”. The Java Language. Java Libraries. How New Libraries are Developed. Three Execution Environments. Applets. Server-Side Java. Some Light Relief-A Java Desktop Application.

2. The Story of O: Object-Oriented Programming.


Abstraction. Encapsulation. Comparing Primitive Types to Class Types. Defining a Type. Declaring Variables. Newsflash: Object vs. Reference to an Object! Operations on Primitive Types/Methods on Objects. The One-Minute Object Manager. Creating New Objects: Constructors. A First Glimpse at Inheritance. How Constructors Are Invoked. No Destructors. Methods. You Always Get to an Object with a “Reference Variable”. The “null” Reference. Dynamic Data Structures. Per-Instance and Per-Class Members. Static Data. Static Methods. Static Blocks. Static Classes. The “final” Modifier. The “Blank Final Variable”. Access Modifiers. Exercises. Some Light Relief-It's Not Your Father's IBM.

3. Explanation of a Sample Program.


Explanation of the Example Program. Applications vs. Applets vs. Servlets. Where an Application Starts. Runtime Internals: Stack and Heap. The Class “Object”. Reading the Java API. Some Light Relief-Napster and LimeWire.

4. Identifiers, Keywords, and Types.


Java and Unicode. Scanning. Identifiers. Comments. Keywords. Used for built-in types:. Used for objects:. Used in statements:. Used to modify declarations (visibility, sharing, etc.):. Used for other method or class-related purposes:. Used for larger-than-a-single-class building blocks:. Reserved for possible future use:. The Primitive Types. Boolean. Int. long. Byte. Short. Double. Float. Char. String. String Concatenation. String Comparison and intern(). Some Light Relief-Hatless Atlas.

5. Names, Arrays, Operators, and Accuracy.


Names. When Can an Identifier Be Forward-Referenced? Expressions. Arrays. Creating an Array. Initializing an Array. Arrays of Arrays of ? Have Array Brackets, Will Travel. Operators. Java Operators. The ++ and -- Operators. The % and / Operators. The << >> and >>> Operators. The instanceof Operator. The & | and ^ Operators. The && and || Operators. The ? ... : Operator. The Assignment Operators. The Comma Operator Is Gone. Associativity. How Accurate Are Calculations? Floating-Point Extension. Widening and Narrowing Conversions. What Happens on Overflow? Integer Overflow. Floating Point Overflow. Arithmetic That Cannot Overflow. The Math Package. Further Reading. Some Light Relief-Too Much Bread.

6. More OOP-Extending Classes.


Inheritance. A Java Example of Inheritance. What Happens When Names Collide? Compatibility of Superclass and Subclass. Casting. Polymorphism. Overloading. Overriding. Inheriting from Object. Forcing Overriding off: Final. Forcing Overriding: Abstract. The Class Whose Name Is Class. Exercises. Some Light Relief-The Nerd Detection System.

7. Java Statements.


“Organizing” Statements. Expression Statements. Selection Statements. Statement Notes. Statement Notes. Iteration Statements. Statement Notes. Statement Notes. Statement Notes. Transfer of Control Statements. Statement Notes. Exceptions. The Purpose of Exceptions. How to Cause an Exception (Implicitly and Explicitly). Triggering an Exception. How to Handle ("Catch") an Exception Within the Method Where It Was Thrown. Handling Groups of Related Exceptions. How the Exception Propagates If Not Handled in the Method Where It Was Thrown. How and Why Methods Declare the Exceptions That Can Propagate Out of Them. Fancy Exception Stuff. Summary of Exceptions. The Assert Statement. Further Reading. Exercises. Some Light Relief-MiniScribe: The Hard Luck Hard Disk.

8. Interfaces.


What Problem Does an Interface Solve? Comparable. Interfaces vs. Abstract Classes. Granting Permission Through an Interface-Cloneable. What Protected Really Means. Interfaces in the Java Runtimes. Call Backs. Using Interfaces for Named Constants. The Class Double. Exercises. Some Light Relief-The Odyssey of Naming Hal.

9. Packages and Visibility.


What Are Packages For? How to Choose a Package Name. How the JVM Finds Classes. Putting the Jar File Where Java Will Find It. Telling Java Where to Look for the Jar File or Package Roots. Packages and Access Modifiers. Access Between Two Classes in the Same Package. Access Between Two Unrelated Classes in Different Packages. Access Between a Parent and Child Class in Different Packages. How Many Packages in a Directory? Compilation Units. Import. Nested Classes. Nested Static Classes. Member Classes. Local Classes. Anonymous Classes. How Inner Classes Are Compiled. The Class Character. Java Coding Style. Exercises. Some Light Relief-The Domestic Obfuscated Java Code NonCompetition.

10. Doing Several Things at Once: Threads.


What Are Threads? Two Ways to Obtain a New Thread. A Few Words on Runnable. The Lifecycle of a Thread. Priorities. Thread Groups. Four Kinds of Threads Programming. Unrelated Threads. Related but Unsynchronized Threads. Some Light Relief-The Motion Sensor Solution.

11. Advanced Thread Topics.


More Thread Programming. Mutually-Exclusive Threads. Communicating Mutually-Exclusive Threads. Interrupting a Thread. Piped I/O for Threads. Thread Local Storage. Garbage Collection. Why Do We Need Garbage Collection? Garbage Collection Algorithms. Finalizers. Weak References. Design Patterns. Further Reading. Exercises. Some Light Relief-Are You Certifiable? Sun Certified Java Programmer.

12. Practical Example Explained.


Case Study Java Program: Fritter Engine Shunt. Exercises. Some Light Relief-Apple Armchair Advice.

PART TWO: KEY LIBRARIES.

13. Simple Input Output.


Design Philosophy. File and FileDescriptor Classes. Public members of java.io.File. FileDescriptor. Portability of I/O. Output. Outputting Double-byte Characters. Wrapping a Writer. Methods of java.io.PrintWriter. Other Writer Wrappers. A Filter to Replace Chars. A Class that Uses a Filter. Summary of Writers. Outputting ASCII Characters and Binary Values. Basic OutputStream Methods. java.io.DataOutputStream for Binary Output. java.io.PrintStream for Printable Output. System.in, out, and err. Writing a Binary File. Output Stream Wrappers. Example of Outputting a Zip File. Writing a Zip Archive. Summary of Output Streams. Input. Inputting Double Byte Characters. Basic Reader Methods. An Input Problem Rears Its Ugly Head. Reader Wrappers. Classes That Wrap Readers. Inputting ASCII Characters and Binary Values. Basic InputStream Methods. Methods of java.io.DataInputStream. A Word About IOExceptions. Example. Input Stream Wrappers. GZIP Files and Streams. Suggested Use of Input Streams. Further Reading. Exercises. Some Light Relief-The Illegal Prime Number! Converting a Number to Binary and Writing to a File.

14. Advanced Input Output.


Random Access File. class java.io.RandomAccessFile. Reading from the Keyboard. Running Commands and Getting Output from Them. Executing the Attrib Command from Java. Limitations on Running Processes. Formatted String Output. How Many Digits Are Output? You Can Also Format Dates. Writing Objects to Disk. Serializing and Security. XML Support Class. New I/O Package. Multiplexed Non-blocking Server I/O. Recovering from Blocked Server I/O. Getting and Using a File Channel. Buffers. Read a File Using a Channel and a Bufferú Other Buffer Methods. View Buffers. A Bulk Transfer from a Buffer to an int Arrayú Memory Mapped I/O. Mapped I/O Example import java.io.*;ú File Locking. Charsets and Endian-ness. Big-endian Storage. Little-endian storage. Supported Encodings. Using a Specific Character Setú Byte-Swapping Binary Data. Summary of Charsets. Exercises. Some Light Relief-The Illegal T-Shirt!

15. Regular Expressions, Collections, Utilities.


Regular Expressions and Pattern Matching. Matching a Pattern. Forming Patterns. Range. Single-Character Metacharacters. Quantifiers. Capturing Groups and Back References. Anchors. Alternation. Word Negation. Metawords. Java Grep Program. Collections API. Adding to a Collection. public interface Iterator. List, LinkedList, and ArrayList. Comparable and Comparator. The Collections Helper Class. Set, HashSet, and SortedSet. Map, HashMap, and TreeMap. HashMap Implements Map. Other Utility Classes. Stack. The java.math API. Calendar Utilities. Calendar and GregorianCalendar. Other Utilities. Random. StringTokenizer. Observer and Observable. Properties. java.util.Properties. Note on the Java Native Interface. Further Reading. Exercises. Some Light Relief-Exchanging Apples and Crays.

PART THREE: SERVER-SIDE JAVA.

16. Servlets and JSP.


Why Use Servlets? Releases and Versions. Installing the Tomcat Software. Running the Example Servlets. Ports and Protocols. The HTML to Invoke a Servlet. A Servlet and Its Request/response. Servlet Request. Response to a Servlet Request. Writing Your Own Servlet. Keeping Track of Content Length. Servlet Operating Cycle and Threading. Java Server Pages. Second Example of JSPú. Java Beans in Servlets and JSP. Further Reading. Exercises. Some Light Relief-The Java-Powered Toaster.

17. Networking in Java.


Everything You Need To Know about TCP/IP but Failed to Learn in Kindergarten. What's in the Networking Library? TCP/IP Client/Server Model. A Client Socket in Java. Sending Email by Java. A Server Socket in Java. Socket Protocols. Running the HTTP Server Program. Debugging Sockets. Getting the HTTP Command. HTTP and Web Browsing: Retrieving HTTP Pages. How to Find the IP Address Given to a Machine Name. Some Notes on Protocol and Content Handlers. How to Make an Applet Write a File on the Server. The Linlyn Class for File Transfer. A Multithreaded HTTP Server. A Mapped I/O HTTP Server. Further Reading. Exercises. Some Light Relief-Using Java to Stuff an Online Poll. The Java Votebot.

18. Remote Method Invocation.


Object Serialization. Class Versioning. Remote Method Invocation. The Client Side of RMI. The Server Side of RMI. Creating the Server Stub and Skeleton. Running the RMI Example. Adding the Client Security Manager. Jini Software. Object Communication Middleware. CORBA. IDL. Exercises. Some Light Relief-The Origami Kamikaze Water Bomber.

PART FOUR: CLIENT JAVA.

19. GUI Basics and Event-Handling.


All About Event-Handling. Java Event Model. The JFrame Example. Tips for Slimming Down Handler Code. Making a Top-Level Class into a Listener. Using a Listener Adapter Class. Summary of Event-Handling. Exercises. Some Light Relief-The Mouse That Roared.

20. All About Applets.


Differences Between Applets and Applications and How to Convert Between Them. Embedding a Java Program in a Web Page. The HTML to Invoke an Applet. Starting Applet Execution. Screen Appearance of an Applet. Browser Summary. Passing Parameters to Applets. Build in Debugging Help. Zip Files and Jar Files. Keep Your Software in a Jar. Removing the Contents from a Jar. Java Web Start. HTML Applet Tags. Exercises. Some Light Relief-Three Fine Applets.

21. JFC and the Swing Package.


Java Foundation Classes. Some Terminology. Overview of Jcomponent. All About Controls (JComponents). How to Display Components. Swing Threads-A Caution! Swing Components. Jlabel. Jbutton. JtoolTip. JtextField. JcheckBox. Jpanel. JRadioButton and ButtonGroup. JoptionPane. JscrollPane. JtabbedPane. JeditorPane. More about Swing Components. Further Reading. Exercises. Some Light Relief-The Bible Code.

22. Containers, Layouts, and AWT Loose Ends.


Pluggable Look and Feel. All About Containers. The Container Class Hierarchy. What's in a Swing Container? Jframe. Jpanel. Applet and Japplet. Window and Jwindow. Layout in a Container. FlowLayout. Grid Layout. BorderLayout. BoxLayout. Combining Layouts. Other Layout Managers. Tying up the Loose Ends. The Toolkit. Printing the Screen. Changing Cursor Appearance. How to Simulate Multibutton Mice. Exercises. Some Light Relief-Sky View Cafe: A High Quality Applet.

PART FIVE: ENTERPRISE JAVA.

23. Java Beans in Theory.


What Is Component Software? What Is a Java Bean? Properties and Events. Coding Time, Design Time, Runtime. Refresher on Events. Bean Conventions. Install the Beanbox. Run a Demo Bean. Loading a Bean into the Beanbox. Customizing Bean Properties. Connecting a Button to a Method in Another Bean. Activation Framework and Infobus. Java Activation Framework. Infobus. Limitations of Beans. Enterprise Java Beans (EJB). Using EJB in an Application Server. EJB Summary. Further Reading. Exercises. Some Light Relief-Furby's Brain Transplant.

24. Java Beans in Practice.


The Specification for Two Beans. The Code for the ConverterField Bean. Summary of ConverterField Bean. The Code for DoItButton Bean. Compile, Jar, and Load Classes into Beanbox. Beans are Best Carried Around in Jars. Bean Icons. The Bean Info Class. How to Write BeanInfo. Descriptor Classes. Properties. Describing the Properties in a BeanInfo Class. Weird Exception Handling. Back to Descriptors. Bound Properties. Practical Example of a Bound Property: validNum. Property Change Support for Non-Visual Beans. Summary: Telling Another Bean About a Change in One of Your Values. Connecting a Swing Event to a Method in Another Bean. EventSet Descriptor Code. Hidden State. The Completed, Integrated Rate Calculator. Customizing More Complicated Properties. Constrained Properties. Calling a Method in Another Bean-Don't Do It! Exercises. Some Light Relief-Java's Duke Mascot. Complete Code Listings. DoItButton.java. DoItButtonBeanInfo.java. ConverterField.java. ConverterFieldBeanInfo.java.

25. Java Security.


The Sandbox. Code Signing. The Security Manager. Applying the Security Policy. Signing a Java Program. Step 1: Setup for Applet Signing (One-Time). Step 2: Put All the Files That Make up the Applet into a Jar File. Step 3: Create a Signed Jar File. Step 4: Change the Applet Tag. Step 5: The Person Who Runs the Applet Must Import My Certificate. Step 6: Set up a Security Policy for the User, Allowing Signed Code. Step 7: Run the Code Using the Policy File. Some Light Relief-Software About Nothing. Further References.

26. Relational Databases and SQL.


Introduction to Relational Databases. Primary and Foreign Keys. 1-Many, Many-Many Relationships. Normal Forms. Relational Database Glossary. Basic SQL Primer. Creating and Populating Tables. Querying and Retrieving Data. Subquery Selections. Result Set of a SELECT Query. SELECT Pitfalls. Updating Values. Deleting Records and Tables. SQL Prepared Statements and Stored Procedures. Further Reading. Exercises. Some Light Relief-Reading the Docs.

27. JDBC.


Downloading and Installing the Software. Running the Example Code. Output from Running SimpleApplicationDemo. Connecting to the Database. Executing SQL Statements. Threads and Database Programming. Result Sets. Cursor Support. Batching SQL Statements and Transactions. Transactions. Prepared Statements and Stored Procedures. Complete Example. Database and Result Set Metadata. Further Reading. Exercises. Light Relief-Hear Java Speak! See Java on a PDA!

28. XML and Java.


Some Rules of XML. The Document Type Definition (DTD). What Is XML Used For? XML Versions and Glossary. JAXP Library Contents. Reading XML with DOM Parsers. A Program That Uses a DOM Parser. Reading an XML File-SAX Parsers. A Program That Uses a SAX Parser. The Factory Design Pattern. Design Pattern Summary. Other Java XML Notes. Download and Install the Java XML Software (JAXP). Running the Example Code. Further Reading. Exercises. Some Light Relief-"View Source" on Kevin's Life.

Appendix A.


Graphics Programming. Colors. Fonts and Font Metrics. The Graphics Context. Drawing Text, Lines, and Shapes. Loading and Drawing Images. Loading an Image File in an Application. Loading an Image File in an Applet. Drawing an Image Onto a Graphics Object. The ImageObserver Argument. Image Update. The Media Tracker. Image Processing. Double Buffering. Clipping Rectangles. Taking Images Apart: java.awt.image. Transparent Backgrounds. Animation. Sounds. Some Light Relief-Satan: Oscillate My Metallic Sonatas.

Appendix B.


Obsolete Components of the Abstract Window Toolkit. How the Java Abstract Window Toolkit Works. Controls, Containers, Events. Overview of Controls. All About AWT Controls (Components). Button. Canvas. Adapter Classes. Checkbox. CheckboxGroup. Choice. Label. List. Scrollbar. TextField. TextArea. Menus: Design. Menu: Class. CheckboxMenuItem. Pop-up Menus. All About Containers. ScrollPane. Window. Frame. Panel. Applet. Dialog. FileDialog.

Appendix C.


Powers of 2 and ISO 8859.

Index.

Erscheint lt. Verlag 8.1.2002
Verlagsort Upper Saddle River
Sprache englisch
Maße 178 x 235 mm
Gewicht 1611 g
Themenwelt Informatik Programmiersprachen / -werkzeuge Java
Mathematik / Informatik Informatik Web / Internet
ISBN-10 0-13-032072-2 / 0130320722
ISBN-13 978-0-13-032072-8 / 9780130320728
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich