Essentials of the Java Programming part II 2000.pdf
(
867 KB
)
Pobierz
Essentials of the Java(TM) Programming Language, Part 2
Essentials of the Java(TM) Programming Language, Part 2
A-Z Index
Java
Technolog
y
Home
Page
Online Training
Java Developer Connection(SM)
Downloads, APIs,
Documentation
Java Developer
Connection
Tutorials, Tech Articles,
Training
Online Support
Essentials of the Java
TM
Programming
Language: A Hands-On Guide, Part 2
by Monica Pawlan
Community Discussion
[
CONTENTS
] [
NEXT>>
]
News & Events from
Everywhere
Products from
Everywhere
How Java Technology
is Used Worldwide
This series of lessons builds on the material presented in
Java
TM
Programming Language Basics, Part 1
,
which introduced
applications, applets, and servlets; simple file and database access
operations; and remote method invocation (RMI).
Print Button
The lessons and code examples for Part 2 are somewhat more
complex. They walk you through network communications, building
a user interface using more components, data encryption and
decryption (pseudo code only), grouping multiple data elements
into one object (collections), and internationalizing a program. Part
2 concludes with some object-oriented programming concepts.
Contents
Lesson 1:
Socket Communications
What are Sockets and Threads?
l
About the Examples
l
Example 1: Server-Side Program
l
Example 1: Client-Side Program
l
Example 2: Multithreaded Server Example
l
More Information
Lesson 2:
User Interfaces Revisited
About the Example
l
Fruit Order Client Code
Global Variables
m
m
Constructor
m
Event Handling
m
Cursor Focus
m
Converting Strings to Numbers and Back
l
Server Program Code
l
View Order Client Code
l
Program Improvements
file:///T|/General/Documentation/Java/Basic Java 2/HTML/index.html (1 of 3) [24.07.2000 12:33:21]
l
l
Essentials of the Java(TM) Programming Language, Part 2
l
More Information
Lesson 3:
Cryptography
About the Example
l
Running the Example
l
Pseudo Code
l
More Information
Lesson 4:
Serialization
About the Example
l
Wrapping the Data
l
Sending Data
l
Server Program
l
Receiving Data
l
More Information
Lesson 5:
Collections
About Collections
l
Creating a Set
l
Printing
l
More Information
Lesson 6:
Internationalization
Identify Culturally Dependent Data
l
Create Keyword and Value Pair Files
l
Internationalize Application Text
l
Localize Numbers
l
Compile and Run the Application
l
Program Improvements
l
More Information
Lesson 7:
Packages and Java Archive File Format
Setting up Class Packages
Create the Directories
m
m
Declare the Packages
m
Make Classes and Fields Accessible
m
Change Client Code to Find the Properties File
m
Compile and Run the Example
l
Using JAR Files to Deploy
Server Set of Files
m
m
Fruit Order Client Set of Files
m
View Order Client Set of Files
m
More Information
file:///T|/General/Documentation/Java/Basic Java 2/HTML/index.html (2 of 3) [24.07.2000 12:33:21]
l
l
l
l
l
Essentials of the Java(TM) Programming Language, Part 2
Lesson 8:
Object-Oriented Programming
Object-Oriented Programming Defined
l
Classes
l
Objects
l
Well-Defined Boundaries and Cooperation
l
Inheritance
l
Polymorphism
l
Data Access Levels
l
Your Own Classes
l
Program Improvements
l
More Information
In Closing
Reader Feedback
Tell us what you think of this training book and earn two
DukeDollars.
[Duke]
Very worth reading Worth reading Not worth
reading
If you have other comments or ideas for future training
books, please type them here:
[
TOP
]
Print Button
[ This page was updated: 6-Apr-2000 ]
Products & APIs
|
Developer Connection
|
Docs & Training
|
Online Support
Community Discussion
|
Industry News
|
Solutions Marketplace
|
Case Studies
Glossary
-
Applets
-
Tutorial
-
Employment
-
Business & Licensing
-
Java Store
-
Java in the Real World
FAQ
|
Feedback
|
Map
|
A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's
AT&T Direct Access Number
first.
Sun
Microsystem
s,
Inc.
Copyright © 1995-2000
Sun Microsystems, Inc.
All Rights Reserved.
Terms of Use
.
Privacy Policy
.
file:///T|/General/Documentation/Java/Basic Java 2/HTML/index.html (3 of 3) [24.07.2000 12:33:21]
l
Java (TM) Language Basics, Part 2, Lesson 1: Socket Communications
A-Z Index
Java
Technolog
y
Home
Page
Online Training
Java Developer Connection(SM)
Downloads, APIs,
Documentation
Java Developer
Connection
Tutorials, Tech Articles,
Training
Online Support
Java
TM
Programming Language Basics,
Part 2
Lesson 1: Socket Communications
Community Discussion
[
<<BACK
] [
CONTENTS
] [
NEXT>>
]
News & Events from
Everywhere
Products from
Everywhere
How Java Technology
is Used Worldwide
Java
TM
Programming Language Basics, Part 1
, finished with a
simple network communications example using the Remote Method
Invocation (RMI) application programming interface (API). The RMI
example allows multiple client programs to communicate with the
same server program without any explicit code to do this because
the RMI API is built on sockets and threads.
Print Button
This lesson presents a simple sockets-based program to introduce
the concepts of sockets and multi-threaded programming. A
multi-threaded program performs multiple tasks at one time such
as fielding simultaneous requests from many client programs.
What are Sockets and Threads?
l
About the Examples
l
Example 1: Server-Side Program
l
Example 1: Client-Side Program
l
Example 2: Multithreaded Server Example
l
More Information
What are Sockets and Threads?
A socket is a software endpoint that establishes bidirectional
communication between a server program and one or more client
programs. The socket associates the server program with a specific
hardware port on the machine where it runs so any client program
anywhere in the network with a socket associated with that same
port can communicate with the server program.
A server program typically provides
resources to a network of client
programs. Client programs send
requests to the server program, and
the server program responds to the
request.
One way to handle requests from
more than one client is to make the
server program multi-threaded. A
multi-threaded server creates a thread for each communication it
accepts from a client. A thread is a sequence of instructions that
file:///T|/General/Documentation/Java/Basic Java 2/HTML/socket.html (1 of 9) [24.07.2000 12:33:27]
l
Java (TM) Language Basics, Part 2, Lesson 1: Socket Communications
run independently of the program and of any other threads.
Using threads, a multi-threaded server program can accept a
connection from a client, start a thread for that communication,
and continue listening for requests from other clients.
About the Examples
The examples for this lesson consist of two versions of the client
and server program pair adapted from the
FileIO.java
application
presented in
Part 1, Lesson 6: File Access and Permissions
.
Example 1 sets up a client and server communication between one
server program and one client program. The server program is not
multi-threaded and cannot handle requests from more than one
client.
Example 2 converts the server program to a multi-threaded version
so it can handle requests from more than one client.
Example 1: Client-Side Behavior
The
client program
presents a simple user interface and prompts
for text input. When you click the
Click Me
button, the text is sent to
the server program. The client program expects an echo from the
server and prints the echo it receives on its standard output.
Example 1: Server-Side Behavior
The
server program
presents a simple user interface, and when you
click the
Click Me
button, the text received from the client is
displayed. The server echoes the text it receives whether or not
you click the
Click Me
button.
Example 1: Compile and Run
To run the example programs, start the server program first. If you
do not, the client program cannot establish the socket connection.
file:///T|/General/Documentation/Java/Basic Java 2/HTML/socket.html (2 of 9) [24.07.2000 12:33:27]
Plik z chomika:
blazejg
Inne pliki z tego folderu:
Wireless Java Developing with J2ME 2nd 2003.chm
(2615 KB)
Wireless J2ME Platform Programming , 2002.pdf
(2614 KB)
using uml for modeling a distributed java application 1997.pdf
(707 KB)
Using Java 2 Standard Ed 2001.chm
(6449 KB)
Using Enterprise JavaBeans 2.0 2002.chm
(1098 KB)
Inne foldery tego chomika:
130 linux and unix ebooks
132 C and C++ ebooks
156 database ebooks
237.For.Dummies.ebooks.Wiley.Publishing
Architecture e-books
Zgłoś jeśli
naruszono regulamin