SlideShare una empresa de Scribd logo
1 de 32
Learn Advanced Java Programming
http://www.tops-int.com/java-training-course.html

1
Index
1.
2.
3.
4.
5.
6.
7.
8.
9.

Data Structures
Collections
Generics
Serialization
Networking
Sending Email
Multithreading
Applet Basics
Documentation

http://www.tops-int.com/java-training-course.html

2
1. Data Structures
• The data structures provided by the Java utility package are very
powerful and perform a wide range of functions. These data
structures consist of the following interface and classes:
• Enumeration
• BitSet
• Vector
• Stack
• Dictionary
• Hashtable
• Properties
• All these classes are now legacy and Java-2 has introduced a new
framework called Collections Framework.
http://www.tops-int.com/java-training-course.html

3
• The Enumeration:
The Enumeration interface isn't itself a data structure, but it is very
important within the context of other data structures. The
Enumeration interface defines a means to retrieve successive
elements from a data structure.
For example, Enumeration defines a method called nextElement that
is used to get the next element in a data structure that contains
multiple elements.

• The BitSet :
The BitSet class implements a group of bits or flags that can be set
and cleared individually.
This class is very useful in cases where you need to keep up with a set
of Boolean values; you just assign a bit to each value and set or clear
it as appropriate.
4
http://www.tops-int.com/java-training-course.html
• The Vector
The Vector class is similar to a traditional Java array, except that it can
grow as necessary to accommodate new elements.
Like an array, elements of a Vector object can be accessed via an
index into the vector.
The nice thing about using the Vector class is that you don't have to
worry about setting it to a specific size upon creation; it shrinks and
grows automatically when necessary.

• The Stack
The Stack class implements a last-in-first-out (LIFO) stack of elements.
You can think of a stack literally as a vertical stack of objects; when
you add a new element, it gets stacked on top of the others.
When you pull an element off the stack, it comes off the top. In other
words, the last element you added to the stack is the first one to
come back off.
http://www.tops-int.com/java-training-course.html

5
• The Dictionary
The Dictionary class is an abstract class that defines a data structure
for mapping keys to values.
This is useful in cases where you want to be able to access data via a
particular key rather than an integer index.
Since the Dictionary class is abstract, it provides only the framework
for a key-mapped data structure rather than a specific
implementation.

• The Hashtable
The Hashtable class provides a means of organizing data based on
some user-defined key structure.
For example, in an address list hash table you could store and sort
data based on a key such as ZIP code rather than on a person's name.
The specific meaning of keys in regard to hash tables is totally
dependent on the usage of the hash table and the data it contains.
http://www.tops-int.com/java-training-course.html

6
2. Collections Framework
The collections framework was designed to meet several goals.
• The framework had to be high-performance. The implementations for
the fundamental collections (dynamic arrays, linked lists, trees, and
hashtables) are highly efficient.
• The framework had to allow different types of collections to work in a
similar manner and with a high degree of interoperability.
• Extending and/or adapting a collection had to be easy.
Towards this end, the entire collections framework is designed around
a set of standard interfaces. Several standard implementations such
as LinkedList, HashSet, and TreeSet, of these interfaces are provided
that you may use as-is and you may also implement your own
collection, if you choose.
http://www.tops-int.com/java-training-course.html

7
• Interfaces: These are abstract data types that represent collections.
Interfaces allow collections to be manipulated independently of the
details of their representation. In object-oriented languages,
interfaces generally form a hierarchy.

• Implementations, i.e., Classes: These are the concrete
implementations of the collection interfaces. In essence, they are
reusable data structures.

• Algorithms: These are the methods that perform useful
computations, such as searching and sorting, on objects that
implement collection interfaces. The algorithms are said to be
polymorphic: that is, the same method can be used on many different
implementations of the appropriate collection interface.

http://www.tops-int.com/java-training-course.html

8
• In addition to collections, the framework defines several map
interfaces and classes. Maps store key/value pairs. Although maps
are not collections in the proper use of the term, but they are fully
integrated with collections.

• The Collection Classes:
Java provides a set of standard collection classes that implement
Collection interfaces. Some of the classes provide full
implementations that can be used as-is and others are abstract class,
providing skeletal implementations that are used as starting points
for creating concrete collections.

• The AbstractCollection, AbstractSet, AbstractList,
AbstractSequentialList and AbstractMap classes provide skeletal
implementations of the core collection interfaces, to minimize the
effort required to implement them.
http://www.tops-int.com/java-training-course.html

9
• How to use an Iterator ?
Often, you will want to cycle through the elements in a collection.
For example, you might want to display each element.
The easiest way to do this is to employ an iterator, which is an object
that implements either the Iterator or the ListIterator interface.

• How to use a Comparator ?
Both TreeSet and TreeMap store elements in sorted order. However,
it is the comparator that defines precisely what sorted order means.
This interface lets us sort a given collection any number of different
ways. Also this interface can be used to sort any instances of any
class (even classes we cannot modify).

http://www.tops-int.com/java-training-course.html

10
3. Generics
Generic Methods:
• You can write a single generic method declaration that can be called
with arguments of different types. Based on the types of the
arguments passed to the generic method, the compiler handles
each method call appropriately. Following are the rules to define
Generic Methods:
• All generic method declarations have a type parameter
section delimited by angle brackets (< and >) that precedes
the method's return type ( < E > in the next example).

• Each type parameter section contains one or more type
parameters separated by commas.
http://www.tops-int.com/java-training-course.html

11
• The type parameters can be used to declare the return type
and act as placeholders for the types of the arguments passed
to the generic method, which are known as actual type
arguments.
• A generic method's body is declared like that of any other
method. Note that type parameters can represent only
reference types, not primitive types (like int, double and char).

• Bounded Type Parameters:
There may be times when you'll want to restrict the kinds of types
that are allowed to be passed to a type parameter. For example, a
method that operates on numbers might only want to accept
instances of Number or its subclasses. This is what bounded type
parameters are for.

http://www.tops-int.com/java-training-course.html

12
4. Serialization
• Java provides a mechanism, called object serialization where an
object can be represented as a sequence of bytes that includes the
object's data as well as information about the object's type and the
types of data stored in the object.
• After a serialized object has been written into a file, it can be read
from the file and desterilized that is, the type information and bytes
that represent the object and its data can be used to recreate the
object in memory.

• Classes ObjectInputStream and ObjectOutputStream are high-level
streams that contain the methods for serializing and desterilizing an
object.
http://www.tops-int.com/java-training-course.html

13
Serializing an Object:
• The ObjectOutputStream class is used to serialize an Object. The
following Serialize Demo program instantiates an Employee object
and serializes it to a file.
• When the program is done executing, a file named employee.ser is
created. The program does not generate any output, but study the
code and try to determine what the program is doing.

http://www.tops-int.com/java-training-course.html

14
5. Networking (Socket Programming)
• The term network programming refers to writing programs that
execute across multiple devices (computers), in which the devices
are all connected to each other using a network.
• The java.net package of the J2SE APIs contains a collection of classes
and interfaces that provide the low-level communication details,
allowing you to write programs that focus on solving the problem at
hand.
The java.net package provides support for the two common network
protocols:

TCP: TCP stands for Transmission Control Protocol, which allows for
reliable communication between two applications. TCP is typically
used over the Internet Protocol, which is referred to as TCP/IP.
http://www.tops-int.com/java-training-course.html

15
• UDP: UDP stands for User Datagram Protocol, a connection-less
protocol that allows for packets of data to be transmitted between
applications.
This tutorial gives good understanding on the following two subjects:

Socket Programming: This is most widely used concept in
Networking and it has been explained in very detail.

URL Processing: This would be covered separately.
Socket Programming:
• Sockets provide the communication mechanism between two
computers using TCP. A client program creates a socket on its end of
the communication and attempts to connect that socket to a server.

http://www.tops-int.com/java-training-course.html

16
The following steps occur when establishing a TCP connection
between two computers using sockets:
• The server instantiates a ServerSocket object, denoting which port
number communication is to occur on.
• The server invokes the accept() method of the ServerSocket class.
This method waits until a client connects to the server on the given
port.
• After the server is waiting, a client instantiates a Socket object,
specifying the server name and port number to connect to.
• The constructor of the Socket class attempts to connect the client to
the specified server and port number. If communication is
established, the client now has a Socket object capable of
communicating with the server.
• On the server side, the accept() method returns a reference to a new
socket on the server that is connected to the client's socket.
http://www.tops-int.com/java-training-course.html

17
6. Sending Email
• To send an e-mail using your Java Application is simple enough but to
start with you should haveJavaMail API and Java Activation
Framework (JAF) installed on your machine.
– You can download latest version of JavaMail (Version 1.2) from
Java's standard website.
– You can download latest version of JAF (Version 1.1.1) from Java's
standard website.
• Download and unzip these files, in the newly created top level
directories you will find a number of jar files for both the
applications. You need to add mail.jar and activation.jar files in your
CLASSPATH.
http://www.tops-int.com/java-training-course.html

18
7. Multithreading
• Java provides built-in support for multithreaded programming. A
multithreaded program contains two or more parts that can run
concurrently. Each part of such a program is called a thread, and each
thread defines a separate path of execution.
• A multithreading is a specialized form of multitasking. Multithreading
requires less overhead than multitasking processing.
• I need to define another term related to threads: process: A process
consists of the memory space allocated by the operating system that
can contain one or more threads. A thread cannot exist on its own; it
must be a part of a process.
• Multithreading enables you to write very efficient programs that
make maximum use of the CPU, because idle time can be kept to a
minimum.
http://www.tops-int.com/java-training-course.html

19
Life Cycle of a Thread:
• A thread goes through various stages in its life cycle. For
example, a thread is born, started, runs, and then dies.
Following diagram shows complete life cycle of a thread.

http://www.tops-int.com/java-training-course.html

20
Above-mentioned stages are explained here:

New: A new thread begins its life cycle in the new state. It remains in
this state until the program starts the thread. It is also referred to as a
born thread.

Runnable: After a newly born thread is started, the thread becomes
runnable. A thread in this state is considered to be executing its task.

Waiting: Sometimes, a thread transitions to the waiting state while
the thread waits for another thread to perform a task.A thread
transitions back to the runnable state only when another thread
signals the waiting thread to continue executing.

Timed waiting: A runnable thread can enter the timed waiting state
for a specified interval of time. A thread in this state transitions back
to the runnable state when that time interval expires or when the
event it is waiting for occurs.

Terminated: A runnable thread enters the terminated state when it
completes its task or otherwise terminates.

http://www.tops-int.com/java-training-course.html

21
Create Thread by Implementing Runnable:
• The easiest way to create a thread is to create a class that implements
the Runnable interface.
• To implement Runnable, a class needs to only implement a single
method called run( ), which is declared like this:
public void run( )
• You will define the code that constitutes the new thread inside run()
method. It is important to understand that run() can call other
methods, use other classes, and declare variables, just like the main
thread can.
• After you create a class that implements Runnable, you will
instantiate an object of type Thread from within that class. Thread
defines several constructors. The one that we will use is shown here:
http://www.tops-int.com/java-training-course.html

22
•

•

•

•

Thread(Runnable threadOb, String threadName);
Here, threadOb is an instance of a class that implements the
Runnable interface and the name of the new thread is specified
by threadName.
After the new thread is created, it will not start running until you call
its start( ) method, which is declared within Thread. The start( )
method is shown here:
void start( );
Using Multithreading:
The key to utilizing multithreading support effectively is to think
concurrently rather than serially. For example, when you have two
subsystems within a program that can execute concurrently, make
them individual threads.
With the careful use of multithreading, you can create very efficient
programs.
http://www.tops-int.com/java-training-course.html

23
8. Applet Basics
•
•
•
•
•

•

There are some important differences between an applet and a
standalone Java application, including the following:
An applet is a Java class that extends the java.applet.Applet class.
A main() method is not invoked on an applet, and an applet class will
not define main().
Applets are designed to be embedded within an HTML page.
When a user views an HTML page that contains an applet, the code
for the applet is downloaded to the user's machine.
A JVM is required to view an applet. The JVM can be either a plug-in
of the Web browser or a separate runtime environment.
The JVM on the user's machine creates an instance of the applet
class and invokes various methods during the applet's lifetime.
http://www.tops-int.com/java-training-course.html

24
Life Cycle of an Applet:
Four methods in the Applet class give you the framework on which
you build any serious applet:

init: This method is intended for whatever initialization is needed for
your applet. It is called after the param tags inside the applet tag have
been processed.

start: This method is automatically called after the browser calls the
init method. It is also called whenever the user returns to the page
containing the applet after having gone off to other pages.

stop: This method is automatically called when the user moves off
the page on which the applet sits. It can, therefore, be called
repeatedly in the same applet.
http://www.tops-int.com/java-training-course.html

25
Destroy:This method is only called when the browser shuts down
normally. Because applets are meant to live on an HTML page, you
should not normally leave resources behind after a user leaves the
page that contains the applet.

Paint: Invoked immediately after the start() method, and also any
time the applet needs to repaint itself in the browser. The paint()
method is actually inherited from the java.awt.

The Applet CLASS:
• Every applet is an extension of the java.applet.Applet class. The base
Applet class provides methods that a derived Applet class may call to
obtain information and services from the browser context.
These include methods that do the following:
– Get applet parameters
http://www.tops-int.com/java-training-course.html

26
–
–
–
–
–
–
–

Get the network location of the HTML file that contains the applet
Get the network location of the applet class directory
Print a status message in the browser
Fetch an image
Fetch an audio clip
Play an audio clip
Resize the applet

Getting Applet Parameters:
• The following example demonstrates how to make an applet respond
to setup parameters specified in the document. This applet displays a
checkerboard pattern of black and a second color.
• The second color and the size of each square may be specified as
parameters to the applet within the document.

http://www.tops-int.com/java-training-course.html

27
• CheckerApplet gets its parameters in the init() method. It may also
get its parameters in the paint() method. However, getting the values
and saving the settings once at the start of the applet, instead of at
every refresh, is convenient and efficient.
• The applet viewer or browser calls the init() method of each applet it
runs. The viewer calls init() once, immediately after loading the
applet. (Applet.init() is implemented to do nothing.) Override the
default implementation to insert custom initialization code.
• The Applet.getParameter() method fetches a parameter given the
parameter's name (the value of a parameter is always a string). If the
value is numeric or other non-character data, the string must be
parsed.
http://www.tops-int.com/java-training-course.html

28
9. Documentation Comments
• Java supports three types of comments. The first two are the // and
the /* */. The third type is called a documentation comment. It
begins with the character sequence /** and it ends with */.
• Documentation comments allow you to embed information about
your program into the program itself. You can then use the javadoc
utility program to extract the information and put it into an HTML file.

Documentation Comment:
• After the beginning /**, the first line or lines become the main
description of your class, variable, or method.
• After that, you can include one or more of the various @ tags. Each @
tag must start at the beginning of a new line or follow an asterisk (*)
that is at the start of a line.
http://www.tops-int.com/java-training-course.html

29
• Multiple tags of the same type should be grouped together. For
example, if you have three @see tags, put them one after the other.
• What javadoc Outputs?
• The javadoc program takes as input your Java program's source file
and outputs several HTML files that contain the program's
documentation.
• Information about each class will be in its own HTML file. Java
utility javadoc will also output an index and a hierarchy tree. Other
HTML files can be generated.
• Since different implementations of javadoc may work differently, you
will need to check the instructions that accompany your Java
development system for details specific to your version.

http://www.tops-int.com/java-training-course.html

30
http://www.tops-int.com/java-training-course.html

31
Contact us for Java Training
Ahmedabad Office
(C.G Road)

Ahmedabad Office
(maninagar)

903 Samedh Complex,
Next to Associated Petrol
Pump,
CG Road,
Ahmedabad 380009.
99747 55006

401 Amruta Arcade 4th
Floor,
Maninagar Char Rasta,
Nr Rly Station,
Maninagar,
Ahmedabad.
99748 63333

http://www.tops-int.com/java-training-course.html

32

Más contenido relacionado

La actualidad más candente

input/ output in java
input/ output  in javainput/ output  in java
input/ output in javasharma230399
 
Semantic Web - Ontology 101
Semantic Web - Ontology 101Semantic Web - Ontology 101
Semantic Web - Ontology 101Luigi De Russis
 
java.io - streams and files
java.io - streams and filesjava.io - streams and files
java.io - streams and filesMarcello Thiry
 
Rdf Processing On The Java Platform
Rdf Processing On The Java PlatformRdf Processing On The Java Platform
Rdf Processing On The Java Platformguestc1b16406
 
FireWatir - Web Application Testing Using Ruby and Firefox
FireWatir - Web Application Testing Using Ruby and FirefoxFireWatir - Web Application Testing Using Ruby and Firefox
FireWatir - Web Application Testing Using Ruby and Firefoxangrez
 
File handling in input and output
File handling in input and outputFile handling in input and output
File handling in input and outputpradeepa velmurugan
 
Application of Ontology in Semantic Information Retrieval by Prof Shahrul Azm...
Application of Ontology in Semantic Information Retrieval by Prof Shahrul Azm...Application of Ontology in Semantic Information Retrieval by Prof Shahrul Azm...
Application of Ontology in Semantic Information Retrieval by Prof Shahrul Azm...Khirulnizam Abd Rahman
 
NE7012- SOCIAL NETWORK ANALYSIS
NE7012- SOCIAL NETWORK ANALYSISNE7012- SOCIAL NETWORK ANALYSIS
NE7012- SOCIAL NETWORK ANALYSISrathnaarul
 
Xml query language and navigation
Xml query language and navigationXml query language and navigation
Xml query language and navigationRaghu nath
 

La actualidad más candente (19)

L02 Software Design
L02 Software DesignL02 Software Design
L02 Software Design
 
[ppt]
[ppt][ppt]
[ppt]
 
input/ output in java
input/ output  in javainput/ output  in java
input/ output in java
 
Quick Scala
Quick ScalaQuick Scala
Quick Scala
 
Javaiostream
JavaiostreamJavaiostream
Javaiostream
 
Input output streams
Input output streamsInput output streams
Input output streams
 
Lecture 23
Lecture 23Lecture 23
Lecture 23
 
Semantic Web - Ontology 101
Semantic Web - Ontology 101Semantic Web - Ontology 101
Semantic Web - Ontology 101
 
java.io - streams and files
java.io - streams and filesjava.io - streams and files
java.io - streams and files
 
Stl
StlStl
Stl
 
Rdf Processing On The Java Platform
Rdf Processing On The Java PlatformRdf Processing On The Java Platform
Rdf Processing On The Java Platform
 
FireWatir - Web Application Testing Using Ruby and Firefox
FireWatir - Web Application Testing Using Ruby and FirefoxFireWatir - Web Application Testing Using Ruby and Firefox
FireWatir - Web Application Testing Using Ruby and Firefox
 
Basics
BasicsBasics
Basics
 
File handling in input and output
File handling in input and outputFile handling in input and output
File handling in input and output
 
Javaio
JavaioJavaio
Javaio
 
Application of Ontology in Semantic Information Retrieval by Prof Shahrul Azm...
Application of Ontology in Semantic Information Retrieval by Prof Shahrul Azm...Application of Ontology in Semantic Information Retrieval by Prof Shahrul Azm...
Application of Ontology in Semantic Information Retrieval by Prof Shahrul Azm...
 
NE7012- SOCIAL NETWORK ANALYSIS
NE7012- SOCIAL NETWORK ANALYSISNE7012- SOCIAL NETWORK ANALYSIS
NE7012- SOCIAL NETWORK ANALYSIS
 
Xml query language and navigation
Xml query language and navigationXml query language and navigation
Xml query language and navigation
 
Files in java
Files in javaFiles in java
Files in java
 

Destacado

Advanced Java Programming
Advanced Java ProgrammingAdvanced Java Programming
Advanced Java ProgrammingAmbo University
 
I/O in java Part 1
I/O in java Part 1I/O in java Part 1
I/O in java Part 1ashishspace
 
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris RechtThe Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris RechtThe Port
 
SAP_Business_Object_Professional
SAP_Business_Object_ProfessionalSAP_Business_Object_Professional
SAP_Business_Object_ProfessionalKapil Verma
 
Global leader in real-time clearing
Global leader in real-time clearingGlobal leader in real-time clearing
Global leader in real-time clearingCinnober
 
PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012Arun Gupta
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streamsShahjahan Samoon
 
Developing With JAAS
Developing With JAASDeveloping With JAAS
Developing With JAASrahmed_sct
 
Static Analysis Primer
Static Analysis PrimerStatic Analysis Primer
Static Analysis PrimerCoverity
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arraystameemyousaf
 
A Short Intorduction to JasperReports
A Short Intorduction to JasperReportsA Short Intorduction to JasperReports
A Short Intorduction to JasperReportsGuo Albert
 
Java Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsJava Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsAnton Keks
 
RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RSArun Gupta
 
Introduction to Jasper Reports
Introduction to Jasper ReportsIntroduction to Jasper Reports
Introduction to Jasper ReportsMindfire Solutions
 
Itp 120 Chapt 19 2009 Binary Input & Output
Itp 120 Chapt 19 2009 Binary Input & OutputItp 120 Chapt 19 2009 Binary Input & Output
Itp 120 Chapt 19 2009 Binary Input & Outputphanleson
 
Architecture of message oriented middleware
Architecture of message oriented middlewareArchitecture of message oriented middleware
Architecture of message oriented middlewareLikan Patra
 

Destacado (20)

Advanced Java Programming
Advanced Java ProgrammingAdvanced Java Programming
Advanced Java Programming
 
I/O in java Part 1
I/O in java Part 1I/O in java Part 1
I/O in java Part 1
 
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris RechtThe Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
 
SAP_Business_Object_Professional
SAP_Business_Object_ProfessionalSAP_Business_Object_Professional
SAP_Business_Object_Professional
 
Core & advanced java classes in mumbai
Core & advanced java classes in mumbaiCore & advanced java classes in mumbai
Core & advanced java classes in mumbai
 
Global leader in real-time clearing
Global leader in real-time clearingGlobal leader in real-time clearing
Global leader in real-time clearing
 
PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
 
Developing With JAAS
Developing With JAASDeveloping With JAAS
Developing With JAAS
 
Static Analysis Primer
Static Analysis PrimerStatic Analysis Primer
Static Analysis Primer
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays
 
A Short Intorduction to JasperReports
A Short Intorduction to JasperReportsA Short Intorduction to JasperReports
A Short Intorduction to JasperReports
 
Java Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsJava Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and Streams
 
Java I/O
Java I/OJava I/O
Java I/O
 
RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RS
 
Introduction to Jasper Reports
Introduction to Jasper ReportsIntroduction to Jasper Reports
Introduction to Jasper Reports
 
Advance Java
Advance JavaAdvance Java
Advance Java
 
Itp 120 Chapt 19 2009 Binary Input & Output
Itp 120 Chapt 19 2009 Binary Input & OutputItp 120 Chapt 19 2009 Binary Input & Output
Itp 120 Chapt 19 2009 Binary Input & Output
 
Japer Reports
Japer ReportsJaper Reports
Japer Reports
 
Architecture of message oriented middleware
Architecture of message oriented middlewareArchitecture of message oriented middleware
Architecture of message oriented middleware
 

Similar a Learn advanced java programming

Collectn framework copy
Collectn framework   copyCollectn framework   copy
Collectn framework copycharan kumar
 
Collectn framework
Collectn frameworkCollectn framework
Collectn frameworkcharan kumar
 
Data Structure & Algorithm.pptx
Data Structure & Algorithm.pptxData Structure & Algorithm.pptx
Data Structure & Algorithm.pptxMumtaz
 
Java collections
Java collectionsJava collections
Java collectionsAmar Kutwal
 
Learnadvancedjavaprogramming 131217055604-phpapp02
Learnadvancedjavaprogramming 131217055604-phpapp02Learnadvancedjavaprogramming 131217055604-phpapp02
Learnadvancedjavaprogramming 131217055604-phpapp02Hardeep Kaur
 
1. Java Collections Framework Introduction
1. Java Collections Framework Introduction1. Java Collections Framework Introduction
1. Java Collections Framework IntroductionBharat Savani
 
Java collections
Java collectionsJava collections
Java collectionspadmad2291
 
Introducing object oriented programming (oop)
Introducing object oriented programming (oop)Introducing object oriented programming (oop)
Introducing object oriented programming (oop)Hemlathadhevi Annadhurai
 
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4358 33 powerpoint-slides_4-introduction-data-structures_chapter-4
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4sumitbardhan
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm. Abdul salam
 
C++ training
C++ training C++ training
C++ training PL Sharma
 

Similar a Learn advanced java programming (20)

Collectn framework copy
Collectn framework   copyCollectn framework   copy
Collectn framework copy
 
Collectn framework
Collectn frameworkCollectn framework
Collectn framework
 
Collections
CollectionsCollections
Collections
 
Data Structure & Algorithm.pptx
Data Structure & Algorithm.pptxData Structure & Algorithm.pptx
Data Structure & Algorithm.pptx
 
Java collections
Java collectionsJava collections
Java collections
 
Java collections
Java collectionsJava collections
Java collections
 
Learnadvancedjavaprogramming 131217055604-phpapp02
Learnadvancedjavaprogramming 131217055604-phpapp02Learnadvancedjavaprogramming 131217055604-phpapp02
Learnadvancedjavaprogramming 131217055604-phpapp02
 
1. Java Collections Framework Introduction
1. Java Collections Framework Introduction1. Java Collections Framework Introduction
1. Java Collections Framework Introduction
 
Java_Interview Qns
Java_Interview QnsJava_Interview Qns
Java_Interview Qns
 
Javasession6
Javasession6Javasession6
Javasession6
 
Java Jive 002.pptx
Java Jive 002.pptxJava Jive 002.pptx
Java Jive 002.pptx
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
 
Java mcq
Java mcqJava mcq
Java mcq
 
Java collections
Java collectionsJava collections
Java collections
 
Introducing object oriented programming (oop)
Introducing object oriented programming (oop)Introducing object oriented programming (oop)
Introducing object oriented programming (oop)
 
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4358 33 powerpoint-slides_4-introduction-data-structures_chapter-4
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm.
 
C++ training
C++ training C++ training
C++ training
 
Beginning linq
Beginning linqBeginning linq
Beginning linq
 
Ordbms
OrdbmsOrdbms
Ordbms
 

Más de TOPS Technologies

Learn java objects inheritance-overriding-polymorphism
Learn java objects  inheritance-overriding-polymorphismLearn java objects  inheritance-overriding-polymorphism
Learn java objects inheritance-overriding-polymorphismTOPS Technologies
 
Surat tops conducted one hour seminar on “corporate basic skills”
Surat tops conducted  one hour seminar on “corporate basic skills”Surat tops conducted  one hour seminar on “corporate basic skills”
Surat tops conducted one hour seminar on “corporate basic skills”TOPS Technologies
 
Word press interview question and answer tops technologies
Word press interview question and answer   tops technologiesWord press interview question and answer   tops technologies
Word press interview question and answer tops technologiesTOPS Technologies
 
Software testing and quality assurance
Software testing and quality assuranceSoftware testing and quality assurance
Software testing and quality assuranceTOPS Technologies
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applicationsTOPS Technologies
 
What is ui element in i phone developmetn
What is ui element in i phone developmetnWhat is ui element in i phone developmetn
What is ui element in i phone developmetnTOPS Technologies
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applicationsTOPS Technologies
 
Software testing live project training
Software testing live project trainingSoftware testing live project training
Software testing live project trainingTOPS Technologies
 
Web designing live project training
Web designing live project trainingWeb designing live project training
Web designing live project trainingTOPS Technologies
 
iPhone training in ahmedabad by tops technologies
iPhone training in ahmedabad by tops technologiesiPhone training in ahmedabad by tops technologies
iPhone training in ahmedabad by tops technologiesTOPS Technologies
 
08 10-2013 gtu projects - develop final sem gtu project in i phone
08 10-2013 gtu projects - develop final sem gtu project in i phone08 10-2013 gtu projects - develop final sem gtu project in i phone
08 10-2013 gtu projects - develop final sem gtu project in i phoneTOPS Technologies
 
GTU PHP Project Training Guidelines
GTU PHP Project Training GuidelinesGTU PHP Project Training Guidelines
GTU PHP Project Training GuidelinesTOPS Technologies
 
GTU Asp.net Project Training Guidelines
GTU Asp.net Project Training GuidelinesGTU Asp.net Project Training Guidelines
GTU Asp.net Project Training GuidelinesTOPS Technologies
 
GTU Guidelines for Project on JAVA
GTU Guidelines for Project on JAVAGTU Guidelines for Project on JAVA
GTU Guidelines for Project on JAVATOPS Technologies
 

Más de TOPS Technologies (20)

Learn java objects inheritance-overriding-polymorphism
Learn java objects  inheritance-overriding-polymorphismLearn java objects  inheritance-overriding-polymorphism
Learn java objects inheritance-overriding-polymorphism
 
Surat tops conducted one hour seminar on “corporate basic skills”
Surat tops conducted  one hour seminar on “corporate basic skills”Surat tops conducted  one hour seminar on “corporate basic skills”
Surat tops conducted one hour seminar on “corporate basic skills”
 
Word press interview question and answer tops technologies
Word press interview question and answer   tops technologiesWord press interview question and answer   tops technologies
Word press interview question and answer tops technologies
 
How to install android sdk
How to install android sdkHow to install android sdk
How to install android sdk
 
Software testing and quality assurance
Software testing and quality assuranceSoftware testing and quality assurance
Software testing and quality assurance
 
Basics in software testing
Basics in software testingBasics in software testing
Basics in software testing
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
 
What is ui element in i phone developmetn
What is ui element in i phone developmetnWhat is ui element in i phone developmetn
What is ui element in i phone developmetn
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
 
Java live project training
Java live project trainingJava live project training
Java live project training
 
Software testing live project training
Software testing live project trainingSoftware testing live project training
Software testing live project training
 
Web designing live project training
Web designing live project trainingWeb designing live project training
Web designing live project training
 
Php live project training
Php live project trainingPhp live project training
Php live project training
 
iPhone training in ahmedabad by tops technologies
iPhone training in ahmedabad by tops technologiesiPhone training in ahmedabad by tops technologies
iPhone training in ahmedabad by tops technologies
 
Php training in ahmedabad
Php training in ahmedabadPhp training in ahmedabad
Php training in ahmedabad
 
Java training in ahmedabad
Java training in ahmedabadJava training in ahmedabad
Java training in ahmedabad
 
08 10-2013 gtu projects - develop final sem gtu project in i phone
08 10-2013 gtu projects - develop final sem gtu project in i phone08 10-2013 gtu projects - develop final sem gtu project in i phone
08 10-2013 gtu projects - develop final sem gtu project in i phone
 
GTU PHP Project Training Guidelines
GTU PHP Project Training GuidelinesGTU PHP Project Training Guidelines
GTU PHP Project Training Guidelines
 
GTU Asp.net Project Training Guidelines
GTU Asp.net Project Training GuidelinesGTU Asp.net Project Training Guidelines
GTU Asp.net Project Training Guidelines
 
GTU Guidelines for Project on JAVA
GTU Guidelines for Project on JAVAGTU Guidelines for Project on JAVA
GTU Guidelines for Project on JAVA
 

Último

The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 

Último (20)

INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 

Learn advanced java programming

  • 1. Learn Advanced Java Programming http://www.tops-int.com/java-training-course.html 1
  • 3. 1. Data Structures • The data structures provided by the Java utility package are very powerful and perform a wide range of functions. These data structures consist of the following interface and classes: • Enumeration • BitSet • Vector • Stack • Dictionary • Hashtable • Properties • All these classes are now legacy and Java-2 has introduced a new framework called Collections Framework. http://www.tops-int.com/java-training-course.html 3
  • 4. • The Enumeration: The Enumeration interface isn't itself a data structure, but it is very important within the context of other data structures. The Enumeration interface defines a means to retrieve successive elements from a data structure. For example, Enumeration defines a method called nextElement that is used to get the next element in a data structure that contains multiple elements. • The BitSet : The BitSet class implements a group of bits or flags that can be set and cleared individually. This class is very useful in cases where you need to keep up with a set of Boolean values; you just assign a bit to each value and set or clear it as appropriate. 4 http://www.tops-int.com/java-training-course.html
  • 5. • The Vector The Vector class is similar to a traditional Java array, except that it can grow as necessary to accommodate new elements. Like an array, elements of a Vector object can be accessed via an index into the vector. The nice thing about using the Vector class is that you don't have to worry about setting it to a specific size upon creation; it shrinks and grows automatically when necessary. • The Stack The Stack class implements a last-in-first-out (LIFO) stack of elements. You can think of a stack literally as a vertical stack of objects; when you add a new element, it gets stacked on top of the others. When you pull an element off the stack, it comes off the top. In other words, the last element you added to the stack is the first one to come back off. http://www.tops-int.com/java-training-course.html 5
  • 6. • The Dictionary The Dictionary class is an abstract class that defines a data structure for mapping keys to values. This is useful in cases where you want to be able to access data via a particular key rather than an integer index. Since the Dictionary class is abstract, it provides only the framework for a key-mapped data structure rather than a specific implementation. • The Hashtable The Hashtable class provides a means of organizing data based on some user-defined key structure. For example, in an address list hash table you could store and sort data based on a key such as ZIP code rather than on a person's name. The specific meaning of keys in regard to hash tables is totally dependent on the usage of the hash table and the data it contains. http://www.tops-int.com/java-training-course.html 6
  • 7. 2. Collections Framework The collections framework was designed to meet several goals. • The framework had to be high-performance. The implementations for the fundamental collections (dynamic arrays, linked lists, trees, and hashtables) are highly efficient. • The framework had to allow different types of collections to work in a similar manner and with a high degree of interoperability. • Extending and/or adapting a collection had to be easy. Towards this end, the entire collections framework is designed around a set of standard interfaces. Several standard implementations such as LinkedList, HashSet, and TreeSet, of these interfaces are provided that you may use as-is and you may also implement your own collection, if you choose. http://www.tops-int.com/java-training-course.html 7
  • 8. • Interfaces: These are abstract data types that represent collections. Interfaces allow collections to be manipulated independently of the details of their representation. In object-oriented languages, interfaces generally form a hierarchy. • Implementations, i.e., Classes: These are the concrete implementations of the collection interfaces. In essence, they are reusable data structures. • Algorithms: These are the methods that perform useful computations, such as searching and sorting, on objects that implement collection interfaces. The algorithms are said to be polymorphic: that is, the same method can be used on many different implementations of the appropriate collection interface. http://www.tops-int.com/java-training-course.html 8
  • 9. • In addition to collections, the framework defines several map interfaces and classes. Maps store key/value pairs. Although maps are not collections in the proper use of the term, but they are fully integrated with collections. • The Collection Classes: Java provides a set of standard collection classes that implement Collection interfaces. Some of the classes provide full implementations that can be used as-is and others are abstract class, providing skeletal implementations that are used as starting points for creating concrete collections. • The AbstractCollection, AbstractSet, AbstractList, AbstractSequentialList and AbstractMap classes provide skeletal implementations of the core collection interfaces, to minimize the effort required to implement them. http://www.tops-int.com/java-training-course.html 9
  • 10. • How to use an Iterator ? Often, you will want to cycle through the elements in a collection. For example, you might want to display each element. The easiest way to do this is to employ an iterator, which is an object that implements either the Iterator or the ListIterator interface. • How to use a Comparator ? Both TreeSet and TreeMap store elements in sorted order. However, it is the comparator that defines precisely what sorted order means. This interface lets us sort a given collection any number of different ways. Also this interface can be used to sort any instances of any class (even classes we cannot modify). http://www.tops-int.com/java-training-course.html 10
  • 11. 3. Generics Generic Methods: • You can write a single generic method declaration that can be called with arguments of different types. Based on the types of the arguments passed to the generic method, the compiler handles each method call appropriately. Following are the rules to define Generic Methods: • All generic method declarations have a type parameter section delimited by angle brackets (< and >) that precedes the method's return type ( < E > in the next example). • Each type parameter section contains one or more type parameters separated by commas. http://www.tops-int.com/java-training-course.html 11
  • 12. • The type parameters can be used to declare the return type and act as placeholders for the types of the arguments passed to the generic method, which are known as actual type arguments. • A generic method's body is declared like that of any other method. Note that type parameters can represent only reference types, not primitive types (like int, double and char). • Bounded Type Parameters: There may be times when you'll want to restrict the kinds of types that are allowed to be passed to a type parameter. For example, a method that operates on numbers might only want to accept instances of Number or its subclasses. This is what bounded type parameters are for. http://www.tops-int.com/java-training-course.html 12
  • 13. 4. Serialization • Java provides a mechanism, called object serialization where an object can be represented as a sequence of bytes that includes the object's data as well as information about the object's type and the types of data stored in the object. • After a serialized object has been written into a file, it can be read from the file and desterilized that is, the type information and bytes that represent the object and its data can be used to recreate the object in memory. • Classes ObjectInputStream and ObjectOutputStream are high-level streams that contain the methods for serializing and desterilizing an object. http://www.tops-int.com/java-training-course.html 13
  • 14. Serializing an Object: • The ObjectOutputStream class is used to serialize an Object. The following Serialize Demo program instantiates an Employee object and serializes it to a file. • When the program is done executing, a file named employee.ser is created. The program does not generate any output, but study the code and try to determine what the program is doing. http://www.tops-int.com/java-training-course.html 14
  • 15. 5. Networking (Socket Programming) • The term network programming refers to writing programs that execute across multiple devices (computers), in which the devices are all connected to each other using a network. • The java.net package of the J2SE APIs contains a collection of classes and interfaces that provide the low-level communication details, allowing you to write programs that focus on solving the problem at hand. The java.net package provides support for the two common network protocols: TCP: TCP stands for Transmission Control Protocol, which allows for reliable communication between two applications. TCP is typically used over the Internet Protocol, which is referred to as TCP/IP. http://www.tops-int.com/java-training-course.html 15
  • 16. • UDP: UDP stands for User Datagram Protocol, a connection-less protocol that allows for packets of data to be transmitted between applications. This tutorial gives good understanding on the following two subjects: Socket Programming: This is most widely used concept in Networking and it has been explained in very detail. URL Processing: This would be covered separately. Socket Programming: • Sockets provide the communication mechanism between two computers using TCP. A client program creates a socket on its end of the communication and attempts to connect that socket to a server. http://www.tops-int.com/java-training-course.html 16
  • 17. The following steps occur when establishing a TCP connection between two computers using sockets: • The server instantiates a ServerSocket object, denoting which port number communication is to occur on. • The server invokes the accept() method of the ServerSocket class. This method waits until a client connects to the server on the given port. • After the server is waiting, a client instantiates a Socket object, specifying the server name and port number to connect to. • The constructor of the Socket class attempts to connect the client to the specified server and port number. If communication is established, the client now has a Socket object capable of communicating with the server. • On the server side, the accept() method returns a reference to a new socket on the server that is connected to the client's socket. http://www.tops-int.com/java-training-course.html 17
  • 18. 6. Sending Email • To send an e-mail using your Java Application is simple enough but to start with you should haveJavaMail API and Java Activation Framework (JAF) installed on your machine. – You can download latest version of JavaMail (Version 1.2) from Java's standard website. – You can download latest version of JAF (Version 1.1.1) from Java's standard website. • Download and unzip these files, in the newly created top level directories you will find a number of jar files for both the applications. You need to add mail.jar and activation.jar files in your CLASSPATH. http://www.tops-int.com/java-training-course.html 18
  • 19. 7. Multithreading • Java provides built-in support for multithreaded programming. A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution. • A multithreading is a specialized form of multitasking. Multithreading requires less overhead than multitasking processing. • I need to define another term related to threads: process: A process consists of the memory space allocated by the operating system that can contain one or more threads. A thread cannot exist on its own; it must be a part of a process. • Multithreading enables you to write very efficient programs that make maximum use of the CPU, because idle time can be kept to a minimum. http://www.tops-int.com/java-training-course.html 19
  • 20. Life Cycle of a Thread: • A thread goes through various stages in its life cycle. For example, a thread is born, started, runs, and then dies. Following diagram shows complete life cycle of a thread. http://www.tops-int.com/java-training-course.html 20
  • 21. Above-mentioned stages are explained here: New: A new thread begins its life cycle in the new state. It remains in this state until the program starts the thread. It is also referred to as a born thread. Runnable: After a newly born thread is started, the thread becomes runnable. A thread in this state is considered to be executing its task. Waiting: Sometimes, a thread transitions to the waiting state while the thread waits for another thread to perform a task.A thread transitions back to the runnable state only when another thread signals the waiting thread to continue executing. Timed waiting: A runnable thread can enter the timed waiting state for a specified interval of time. A thread in this state transitions back to the runnable state when that time interval expires or when the event it is waiting for occurs. Terminated: A runnable thread enters the terminated state when it completes its task or otherwise terminates. http://www.tops-int.com/java-training-course.html 21
  • 22. Create Thread by Implementing Runnable: • The easiest way to create a thread is to create a class that implements the Runnable interface. • To implement Runnable, a class needs to only implement a single method called run( ), which is declared like this: public void run( ) • You will define the code that constitutes the new thread inside run() method. It is important to understand that run() can call other methods, use other classes, and declare variables, just like the main thread can. • After you create a class that implements Runnable, you will instantiate an object of type Thread from within that class. Thread defines several constructors. The one that we will use is shown here: http://www.tops-int.com/java-training-course.html 22
  • 23. • • • • Thread(Runnable threadOb, String threadName); Here, threadOb is an instance of a class that implements the Runnable interface and the name of the new thread is specified by threadName. After the new thread is created, it will not start running until you call its start( ) method, which is declared within Thread. The start( ) method is shown here: void start( ); Using Multithreading: The key to utilizing multithreading support effectively is to think concurrently rather than serially. For example, when you have two subsystems within a program that can execute concurrently, make them individual threads. With the careful use of multithreading, you can create very efficient programs. http://www.tops-int.com/java-training-course.html 23
  • 24. 8. Applet Basics • • • • • • There are some important differences between an applet and a standalone Java application, including the following: An applet is a Java class that extends the java.applet.Applet class. A main() method is not invoked on an applet, and an applet class will not define main(). Applets are designed to be embedded within an HTML page. When a user views an HTML page that contains an applet, the code for the applet is downloaded to the user's machine. A JVM is required to view an applet. The JVM can be either a plug-in of the Web browser or a separate runtime environment. The JVM on the user's machine creates an instance of the applet class and invokes various methods during the applet's lifetime. http://www.tops-int.com/java-training-course.html 24
  • 25. Life Cycle of an Applet: Four methods in the Applet class give you the framework on which you build any serious applet: init: This method is intended for whatever initialization is needed for your applet. It is called after the param tags inside the applet tag have been processed. start: This method is automatically called after the browser calls the init method. It is also called whenever the user returns to the page containing the applet after having gone off to other pages. stop: This method is automatically called when the user moves off the page on which the applet sits. It can, therefore, be called repeatedly in the same applet. http://www.tops-int.com/java-training-course.html 25
  • 26. Destroy:This method is only called when the browser shuts down normally. Because applets are meant to live on an HTML page, you should not normally leave resources behind after a user leaves the page that contains the applet. Paint: Invoked immediately after the start() method, and also any time the applet needs to repaint itself in the browser. The paint() method is actually inherited from the java.awt. The Applet CLASS: • Every applet is an extension of the java.applet.Applet class. The base Applet class provides methods that a derived Applet class may call to obtain information and services from the browser context. These include methods that do the following: – Get applet parameters http://www.tops-int.com/java-training-course.html 26
  • 27. – – – – – – – Get the network location of the HTML file that contains the applet Get the network location of the applet class directory Print a status message in the browser Fetch an image Fetch an audio clip Play an audio clip Resize the applet Getting Applet Parameters: • The following example demonstrates how to make an applet respond to setup parameters specified in the document. This applet displays a checkerboard pattern of black and a second color. • The second color and the size of each square may be specified as parameters to the applet within the document. http://www.tops-int.com/java-training-course.html 27
  • 28. • CheckerApplet gets its parameters in the init() method. It may also get its parameters in the paint() method. However, getting the values and saving the settings once at the start of the applet, instead of at every refresh, is convenient and efficient. • The applet viewer or browser calls the init() method of each applet it runs. The viewer calls init() once, immediately after loading the applet. (Applet.init() is implemented to do nothing.) Override the default implementation to insert custom initialization code. • The Applet.getParameter() method fetches a parameter given the parameter's name (the value of a parameter is always a string). If the value is numeric or other non-character data, the string must be parsed. http://www.tops-int.com/java-training-course.html 28
  • 29. 9. Documentation Comments • Java supports three types of comments. The first two are the // and the /* */. The third type is called a documentation comment. It begins with the character sequence /** and it ends with */. • Documentation comments allow you to embed information about your program into the program itself. You can then use the javadoc utility program to extract the information and put it into an HTML file. Documentation Comment: • After the beginning /**, the first line or lines become the main description of your class, variable, or method. • After that, you can include one or more of the various @ tags. Each @ tag must start at the beginning of a new line or follow an asterisk (*) that is at the start of a line. http://www.tops-int.com/java-training-course.html 29
  • 30. • Multiple tags of the same type should be grouped together. For example, if you have three @see tags, put them one after the other. • What javadoc Outputs? • The javadoc program takes as input your Java program's source file and outputs several HTML files that contain the program's documentation. • Information about each class will be in its own HTML file. Java utility javadoc will also output an index and a hierarchy tree. Other HTML files can be generated. • Since different implementations of javadoc may work differently, you will need to check the instructions that accompany your Java development system for details specific to your version. http://www.tops-int.com/java-training-course.html 30
  • 32. Contact us for Java Training Ahmedabad Office (C.G Road) Ahmedabad Office (maninagar) 903 Samedh Complex, Next to Associated Petrol Pump, CG Road, Ahmedabad 380009. 99747 55006 401 Amruta Arcade 4th Floor, Maninagar Char Rasta, Nr Rly Station, Maninagar, Ahmedabad. 99748 63333 http://www.tops-int.com/java-training-course.html 32