Advance&Basic Java
Advance&Basic Java
We can execute Scala code by first compiling it using the scalac command line tool.
object HelloWorld {
println("Hello,World!")
Note
A semicolon at the end of a statement is usually optional.
The main method is defined in an object, not in a class.
Scala program processing starts from the main method, which is a mandatory part of every Scala
program.
The main method is not marked as static.
The main method is an instance method on a singleton object that is automatically instantiated.
There is no return type. Actually there is Unit, which is similar to void, but it is inferred by the compiler.
We can explicitly specify the return type by putting a colon and the type after the parameters:
def main(args: Array[String]) : Unit = {
Scala uses the def keyword to tell the compiler that this is a method.
There is no access level modifier in Scala.
Scala does not specify the public modifier because the default access level is public.
Printing Some Numbers
Let's write a program that will print the numbers from 1 to 10 in the Print1.scalafile:
object Main {
println(i)
2
i <- 1 to 10
j <- 1 to 10
println(i* j)
o Builder Pattern.
o Adapter Pattern
o Bridge Pattern
o Composite Pattern
o Decorator Pattern
o Facade Pattern
o Flyweight Pattern
o Proxy Pattern
Behavioral Design Pattern
What Is a Class?
Classes are the basic units of programming in the object-oriented paradigm. They are used as templates
to create objects.
A class in Java may consist of five components:
Fields
Methods
Constructors
Static initializers
Instance initializers
Fields and methods are also known as members of the class.
Constructors are used to create objects of a class. We must have at least one constructor for a class.
Initializers are used to initialize fields of a class. We can have zero or more initializers of static or
instance types.
Declaring a Class
The general syntax for declaring a class in Java is
<class name> is a user-defined name for the class, which should be a valid identifier.
Each class has a body, which is specified inside a pair of braces ({}).
The body of a class contains its different components, for example, fields, methods, etc.
The following code defines a class named Dog with an empty body. Dog class does not use any
modifiers.
class Dog {
}
Fields in a Class
Fields of a class represent properties or attributes for the class.
Every object of dog class has two properties: a name and a gender. The dog class should include
declarations of two fields: one to represent name and one to represent gender.
The fields are declared inside the body of the class. The general syntax to declare a field in a class is
String name;
String gender;
It is a convention in java to start a class name with an uppercase letter and capitalize the subsequent
words, for example, Table, FirstTime, etc.
The name of fields and methods should start with a lowercase letter and the subsequent words should
be capitalized, for example, name, firstName, etc.
The Dog class declares two fields: name and gender. Both fields are of the String type.
Every instance of the Dog class will have a copy of these two fields.
Java has two types of fields for a class:
Class fields
Instance fields
Sometimes a property belongs to the class itself, not to any particular instance of that class.
The count of all dogs should belong to the dog class itself. The existence of the count of dog is not tied
to any specific instance of the dog class.
Only one copy of the class property exists irrespective of the number of instances.
Class fields are also known as class variables. Instance fields are also known as instance variables.
The name and gender are two instance variables of the Dog class.
All class variables must be declared using the static keyword as a modifier.
The following code has the declaration of the Dog class with a count class variable.
class Dog {
A class variable is known as a static variable. An instance variable is known as a non-static variable.
Identifier
Characters used in an identifier are drawn from the Unicode character set, not only from the
ASCII character set.
Identifiers are case sensitive.
Keywords
volatile while
The two keywords, const and goto, are not currently used in Java.
They are reserved keywords and they cannot be used as identifiers.
In addition to all the keywords, three words, true, false, and null, cannot be used as identifiers; true and
false are boolean literals (or boolean constants) and null is a reference literal.
In stream-based I/O, we write data directly to the stream. In channel-based I/O, we write data into a
buffer and we pass that buffer to the channel, which writes the data to the data destination.
When reading data from a data source, we pass a buffer to a channel. The channel reads data from the
data source into a buffer.
Java 7 introduced New Input/Output 2 API, which provides a new I/O API. It provides many features that
were lacking in the original File I/O API.
It adds three packages to the Java class library: java.nio.file, java.nio.file.attribute, and java.nio.file.spi.
New Input/Output 2 API deals with all file systems in a uniform way. The file system support provided by
New Input/Output 2 API is extensible.
New Input/Output 2 API supports basic file operations (copy, move, and delete) on all file systems. It has
support for symbolic links.
We can creates a watch service to watch for any events on a directory such as adding a new file or a
subdirectory, deleting a file, etc.
JAXP supports the Extensible Stylesheet Language Transformations (XSLT) standard, and we can use it to
convert the XML documents to other formats, such as HTML.
Packages Overview
Package Description
javax.xml.parsers The JAXP APIs provide an interface for various SAX and DOM parsers.
SAX
The Simple API for XML (SAX) is the event-driven, serial-access parser. It processes the XML document
element-by-element.
The SAX API is often used as data filters that do not require an in-memory representation of the XML
data.
DOM
The DOM API builds a tree structure out of the XML document.
We can use the DOM API to manipulate the hierarchy of XML objects.
The entire XML tree is stored in memory by DOM API. It would use more memory than SAX parser
XSLT
We can use the XSLT APIs defined in javax.xml.transform to write XML data to a file or convert the XML
document into other forms, such as HTML or PDF.
StAX
The StAX APIs defined in javax.xml.stream provide a streaming based, event-driven, pull-parsing API for
reading and writing XML documents using Java.
StAX is a simpler than SAX and consumes less memory than DOM.
Operations
We can perform different actions on a collection.
searching through a collection
converting a collection of one type to another type
copying elements from one collection to another
sorting elements of a collection in a specific order
java.lang.reflect.Modifier Decode the access modifiers for a class and its members.
Example Usage
With Java reflection we can do the following tasks.
Get the class name of the object
Get class package name, access modifiers, etc.
Get the methods defined in the class, their return type, access modifiers, parameters type,
parameter names(JDK 8), etc.
Get field
Get all constructors
Create an object of the class using one of its constructors.
Invoke method with the method's name and method's parameter types.
Create an array of a type dynamically at runtime and manipulate its elements.
The following snippet declares an integer variable called num. Java requires that variables must be
declared before they can be used.
int num; // this declares a variable called num
Following is the general form of a variable declaration:
type var-name;
In the program, the line assigns to num the value 100.
num = 100; // this assigns num the value 100
}
}
When the program is run, the following output is displayed:
Example
A block of code as the target of a for loop.
public class Main {
public static void main(String args[]) {
int i, y;/*w ww. ja v a2 s . c o m*/
y = 20;
for (i = 0; i < 10; i++) { // the target of this loop is a block
System.out.println("This is i: " + i);
System.out.println("This is y: " + y);
y = y - 1;
}
}
}
The output generated by this program is shown here:
1. Java
2.
JDK 7 /
Asynchronous Channel8 AtomicLong 1 BitSet 1 ConcurrentHashMap1
JavaFX /
Accordion 1 Animation 10 Application 1 Arc 2
WebView 5
EJB3 /
Annotation 2 AroundInvoke 1 Asynchronous 1 Cluster 2
JPA /
Association Override 1 Attribute Override 1 Basic 2 Blob Clob 3
Named Query 5 Native Query 3 One to Many Mapping9 One to One Mapping8
GWT /
Accordion Panel 7 Animation 20 Application 2 Auto Completion 1
Tab 25 Table Cell Renderer25 Table Column Row 22 Table Data Binding 15
Table Drag Drop 8 Table Editor 20 Table Filter Sorter 10 Table Grouping 7
Widget 1 XML 2
JDK 6 /
Activation Framework2 Array 2 BlockingDeque 2 Console 7
JDK6 Splash Screen 2 JTabbedPane 3 JTable Sort Filter 5 Look and Feel 2
Scripting /
JavaFX 1 JRuby 1
Email /
Email Attachment 2 Email Authenticator 1 Email Client 4 Email Flags 1
Spring /
AfterReturningAdvice 4 AOP 19 ApplicationContext 4 Ap
BasicDataSource 1 BatchPreparedStatementSetter 2 BatchSqlUpdate 1 Be
Hibernate /
Cascade Operation 1 Class Hiearchy Config Generation 6 Criteria Aggregates 1
Mapping 3
Criteria Associations 2 Criteria Data Type 2 Criteria Equal Not Criteria Group 1
Equal 3
Criteria Like 1 Criteria Match Mode 1 Criteria NULL 1 Criteria Projection 2
Criteria Two Criteria Unique 1 DAO Generic DAO 6 DAO Simple DAO 5
Conditions 3
Velocity /
Calculation 2 Class Reference 2 Collections 2 Comments 4
Ant /
Big Project Ant Script33 Build 2 Code Convention 1 Compile 18
Zip 5
J2EE /
acegi 2 iBatis 15 Java Message Service JavaServer Faces 9
JMS 28
JNDI LDAP /
Attributes 4 Binding 5 Connection Pooling 1 Context Event 1
JSP /
Abstract Class 1 Access 1 Applet JSP 4 Application Object 1
JSTL /
Application 3 Browser 1 Calculation 2 Collections 3
Condition 1 Database 6 Date 5 Exceptions 6
Servlets /
Authentication 4 Basics 7 Chart 1 Client 4
Swing JFC /
Accessible 10 Actions 11 Alignment 2 Applet 51
Swing Components /
Action Framework 1 Animation 17 Border 14 Button Bar 1
Wizard 9
WIN32 13 Wizard 4
Event /
Customized Event 7 Event Queue 13 Focus Event 25 General Event 6
Language Basics /
Annotation 20 Arithmetic Operators 3 Assert 11 Binary Bit 26
While 6
Development Class /
Applet Loader 2 Ascii Code 4 Base64 49 Beeper 4
UUID GUID 28
WeakHashMap 11
Regular Expressions /
Basic Regular Date 1 Digit Number 7 Email 1
Expressions 20
I18N /
BreakIterator 9 Calendar 5 Charset 14 Choice Format 2
Reflection /
Annotation 13 Array Reflection 17 Class Method Field Class 36
Name 9
Data Type 3 Database Swing Applet8 Database Type vs Java Database Viewer 1
Type 6
XML /
CDATA 9 Comments 4 DefaultHandler 1 DOCTYPE 1
DOM Action 4 DOM Attribute 19 DOM Document 20 DOM Edit 32
XPathVariableResolver1
Tiny Application /
Browser 4 Calculator 2 Chat 2 Database 1
J2ME /
2D 22 Alert 7 Animation 8 Application 6
Timer 5 XML 2
Network Protocol /
Authenticator 7 Base64 Encoding 5 Compressed Crawler 3
Connection 1
Apache Common /
Bean Utils 7 CharSet 1 Class Helper 5 Code 3
Validate 1
2D Graphics GUI /
Animation 26 AntiAliasing 5 Arc 6 Area Calculation 5
Transparent 2 XOR 2
Chart /
Area Chart 2 Area Stacked Chart 1 Axis 1 Bar Chart 3D
Horizontal 1
Bar Chart 3D Vertical2 Bar Chart 3D 1 Bar Chart Horizontal 4 Bar Chart Vertical 6
Bar Chart 14 Bar Stacked Chart 3D1 Bar Stacked Chart 7 Box and Whisker Chart1
Bubble Chart 2 Candlestick Chart 2 Category Plot Chart 2 Category Step Chart 1
Combined XY Plot 4 Compass Chart 4 Contour Plot Chart 1 Create HTML Image
Map 7
Layered Bar Chart 2 Line Chart Vertical Line Chart 27 Line Plot Chart 1
Horizontal Chart 7
Multiple Pie Chart 4 Multiple Shapes XY Overlaid Bar Chart 2 Overlaid XY Plot Chart2
Chart 1
Scatter Plot Chart 2 Segmented High Low Small Number Chart 1 Speedo Chart 1
Chart 1
Stacked 3D Bar Vertical Stacked Bar Horizontal Stacked Bar Verical Statistical Bar Chart 1
Chart 1 Chart 1 Chart 1
Thermometer Chart 3 Time Period Values Time Series Chart 17 Wafer Map Chart 3
Chart 3
3D /
3D Animation 7 3D Basics 11 3D Environment 6 3D Locale 2
Game /
Behaviour 2 BSP Map 3 Game 2D 3D 2 Game Animation 3
Advanced Graphics /
Animation 10 Cell 3 Chart 7 Curve 10
PDF RTF /
Add Page 1 Anchor Hyperlink 1 Anchor 1 Annotations 9
Table Cell Alignment 7 Table Cell Border 5 Table Cell Color 3 Table Cell Event 1
Table Cell Font 1 Table Cell Image 3 Table Cell Margin 2 Table Cell Size 11
Table Cell Span 1 Table Column 1 Table Default Cell 2 Table Event 1
ZapfDingbatsNumberLists1
Design Pattern /
Adapter Pattern 2 Bridge Pattern 3 Builder Pattern 2 Call Back Pattern 2
Security /
AccessController 9 Algorithms 6 Certificate 11 Check sum 3
Threads /
Atomic 2 BlockingQueue 3 Collections Threads17 Concurrent 5
Class /
abstract class 2 Access Control 4 Anonymous class 5 class cast 2
Data Type cast 16 Date Calculation 77 Date Format 128 Date Parser 10
Generics /
Constraints 7 Generic Class 11 Generic Collection 28 Generic Constructor 1
Java Tutorial
1. Java Tutorial
2.
1.Language
1.1.Introduction( 17 ) 1.9.Variables( 6 )
1.7.Main( 4 ) 1.15.transient( 1 )
1.8.Garbage Collection( 3 )
2.Data Type
2.2.Boolean( 24 ) 2.26.Quote( 1 )
2.15.Cast( 2 ) 2.39.Calendar( 23 )
2.19.String( 22 ) 2.43.enum( 10 )
2.24.String Tokenize( 3 )
3.Operators
4.Statement Control
5.Class Definition
5.2.Constructor( 7 ) 5.20.New( 2 )
5.9.Varargs( 8 ) 5.27.final( 12 )
5.18.Clone( 18 )
6.Development
6.4.Formatter( 4 ) 6.35.Pack200( 1 )
6.8.RuntimeMXBean( 5 ) 6.39.Desktop( 8 )
6.13.DateFormat( 18 ) 6.44.Clipboard( 12 )
6.19.TimeUnit( 2 ) 6.50.Audio( 15 )
6.21.TimeZone( 15 ) 6.52.JNI( 3 )
6.22.Documentation( 1 ) 6.53.CommPortIdentifier( 4 )
6.23.Exception( 28 ) 6.54.UUID( 11 )
6.24.Assertions( 9 ) 6.55.Robot( 9 )
6.25.Toolkit( 3 ) 6.56.JavaBeans( 36 )
6.26.ProcessBuilder( 2 ) 6.57.Base64( 3 )
6.27.Process( 4 ) 6.58.Cache( 1 )
6.28.Applet( 16 ) 6.59.Debug( 10 )
6.29.JNLP( 2 ) 6.60.JDK( 2 )
6.30.CRC32( 1 ) 6.61.OS( 5 )
7.Reflection
7.1.Class( 19 ) 7.10.Generic( 1 )
7.2.Interface( 11 ) 7.11.ClassPath( 5 )
7.3.Constructor( 14 ) 7.12.Modifier( 16 )
7.5.Method( 28 ) 7.14.Name( 11 )
7.6.Package( 13 ) 7.15.PhantomReference( 2 )
7.8.Annotation( 4 ) 7.17.WeakReference( 2 )
7.9.Array( 12 ) 7.18.Proxy( 1 )
8.Regular Expressions
8.3.Group( 4 ) 8.8.Split( 1 )
8.5.Pattern( 13 ) 8.10.Validation( 8 )
9.Collections
9.1.Collections Framework( 7 ) 9.29.TreeMap( 17 )
9.2.Collections( 22 ) 9.30.NavigableMap( 10 )
9.19.HashSet( 34 ) 9.47.Vector( 60 )
9.25.Map( 16 ) 9.53.Sort( 10 )
9.26.HashMap( 33 ) 9.54.Search( 2 )
9.27.LinkedHashMap( 11 ) 9.55.Collections( 1 )
9.28.Map.Entry( 1 ) 9.56.Reference( 3 )
10.Thread
10.6.ThreadGroup( 4 ) 10.17.Semaphore( 1 )
11.File
11.1.Introduction( 4 ) 11.41.Buffer( 1 )
11.2.File( 45 ) 11.42.ByteBuffer( 31 )
11.3.Path( 29 ) 11.43.CharBuffer( 15 )
11.4.Directory( 35 ) 11.44.DoubleBuffer( 3 )
11.7.InputStream( 15 ) 11.47.LongBuffer( 3 )
11.8.FileInputStream( 18 ) 11.48.ShortBuffer( 2 )
11.9.BufferedInputStream( 8 ) 11.49.MappedByteBuffer( 8 )
11.10.InflaterInputStream( 1 ) 11.50.ByteOrder( 2 )
11.11.SequenceInputStream( 2 ) 11.51.FileChannel( 25 )
11.12.FilterInputStream( 4 ) 11.52.WritableByteChannel( 1 )
11.14.FileOutputStream( 17 ) 11.54.Scanner( 10 )
11.16.OutputStreamWriter( 3 ) 11.56.FileSystemView( 1 )
11.17.DataInputStream( 19 ) 11.57.CharSet( 5 )
11.20.DeflaterOutputStream( 1 ) 11.60.ZipOutputStream( 2 )
11.21.FilterOutputStream( 8 ) 11.61.ZipInputStream( 4 )
11.22.ObjectInputStream( 4 ) 11.62.ZipFile( 15 )
11.23.ObjectOutputStream( 8 ) 11.63.JarFile( 24 )
11.24.ByteArrayOutputStream( 2 ) 11.64.JarOutputStream( 1 )
11.25.ByteArrayInputStream( 1 ) 11.65.GZIPInputStream( 4 )
11.26.PipedInputStream( 1 ) 11.66.GZIPOutputStream( 2 )
11.27.PrintStream( 1 ) 11.67.DeflaterOutputStream( 1 )
11.28.Encoding( 1 ) 11.68.InflaterInputStream( 1 )
11.29.Reader( 11 ) 11.69.Checksum( 8 )
11.31.BufferedReader( 12 ) 11.71.FilenameFilter( 6 )
11.32.Writer( 6 ) 11.72.FileFilter( 10 )
11.33.FileWriter( 4 ) 11.73.FileLock( 3 )
11.34.PrintWriter( 7 ) 11.74.StreamTokenizer( 2 )
11.35.StringReader( 3 ) 11.75.CSV( 7 )
11.39.Externalizable( 3 ) 11.79.Delete( 11 )
12.Generics
13.I18N
13.1.Locales( 28 ) 13.13.DecimalFormat( 17 )
13.4.ResourceBundle( 14 ) 13.16.Normalizer( 1 )
13.5.ListResourceBundle( 2 ) 13.17.InputMethod( 1 )
13.6.Applications( 1 ) 13.18.Collator( 5 )
13.9.Calendar( 1 ) 13.21.CharacterIterator( 8 )
13.10.ChoiceFormat( 4 ) 13.22.Collator( 4 )
13.11.Currency( 6 ) 13.23.DateFormatSymbols( 1 )
13.12.Message Format( 18 )
14.Swing
14.2.JComponent( 8 ) 14.66.JTree( 35 )
14.4.AbstractButton( 5 ) 14.68.TreeModel( 6 )
14.9.JRadioButton( 11 ) 14.73.ToolTipManager( 1 )
14.10.ButtonGroup( 3 ) 14.74.JDialog( 14 )
14.11.JCheckBox( 14 ) 14.75.Modality( 6 )
14.12.JComboBox( 33 ) 14.76.JColorChooser( 21 )
14.13.TrayIcon( 7 ) 14.77.JFileChooser( 33 )
14.14.JTextComponent( 41 ) 14.78.JWindow( 5 )
14.18.JFormattedTextField( 26 ) 14.82.Frame( 3 )
14.20.DefaultFormatterFactory( 2 ) 14.84.JRootPane( 6 )
14.21.JMenu( 12 ) 14.85.GlassPane( 2 )
14.22.JMenuBar( 7 ) 14.86.BorderLayout( 6 )
14.23.JMenuItem( 13 ) 14.87.BoxLayout( 15 )
14.24.JCheckBoxMenuItem( 6 ) 14.88.Box( 5 )
14.25.JRadioButtonMenuItem( 2 ) 14.89.FlowLayout( 10 )
14.26.JPopupMenu( 9 ) 14.90.GridLayout( 7 )
14.28.MenuSelectionManager( 4 ) 14.92.SpringLayout( 11 )
14.29.JSeparator( 4 ) 14.93.CardLayout( 3 )
14.30.JSlider( 40 ) 14.94.GridBagLayout( 18 )
14.31.BoundedRangeModel( 2 ) 14.95.GridBagConstraints( 12 )
14.32.JProgressBar( 15 ) 14.96.GroupLayout( 1 )
14.35.JEditorPane( 7 ) 14.99.AbstractBorder( 5 )
14.38.JTextPane( 41 ) 14.102.BevelBorder( 5 )
14.39.SimpleAttributeSet( 5 ) 14.103.SoftBevelBorder( 3 )
14.40.JList( 30 ) 14.104.CompoundBorder( 3 )
14.45.JPanel( 8 ) 14.109.BorderFactory( 16 )
14.46.JScrollPane( 15 ) 14.110.ProgressMonitor( 7 )
14.47.ScrollPaneLayout( 1 ) 14.111.ProgressMonitorInputStream( 1 )
14.51.JTabbedPane( 33 ) 14.115.Cursor( 4 )
14.52.JLayeredPane( 4 ) 14.116.Icon( 9 )
14.57.JToolBar( 14 ) 14.121.UIDefault( 7 )
14.58.JTable( 59 ) 14.122.UIManager( 4 )
14.61.JTableHeader( 11 ) 14.125.SwingWorker( 4 )
14.64.JTable Filter( 4 )
15.Swing Event
15.1.Event( 17 ) 15.23.ListDataListener( 2 )
15.3.Action( 11 ) 15.25.MenuDragMouseListener( 1 )
15.4.InputMap( 10 ) 15.26.MenuKeyListener( 1 )
15.5.ActionListener( 10 ) 15.27.MenuListener( 2 )
15.7.AncestorListener( 1 ) 15.29.MouseListener( 3 )
15.8.CaretListener( 2 ) 15.30.MouseMotionListener( 4 )
15.9.ChangeListener( 6 ) 15.31.MouseWheelListener( 3 )
15.10.ComponentListener( 6 ) 15.32.PopupMenuListener( 1 )
15.11.ContainerListener( 4 ) 15.33.PropertyChangeListener( 1 )
15.12.Document( 6 ) 15.34.Property Event( 1 )
15.13.DocumentListener( 4 ) 15.35.TableModelListener( 1 )
15.15.Focus( 31 ) 15.37.TreeModelListener( 1 )
15.16.FocusListener( 7 ) 15.38.TreeSelectionListener( 5 )
15.17.HierarchyListener( 1 ) 15.39.TreeWillExpandListener( 2 )
15.18.HyperlinkListener( 2 ) 15.40.VetoableChangeListener( 2 )
15.20.ItemListener( 5 ) 15.42.WindowFocusListener( 2 )
15.21.KeyListener( 12 ) 15.43.WindowStateListener( 1 )
15.22.KeyStroke( 22 )
16.2D Graphics
16.1.Repaint( 1 ) 16.28.GIF( 2 )
16.2.Graphics( 8 ) 16.29.JPEG( 2 )
16.3.Tranformation( 13 ) 16.30.PNG( 1 )
16.4.Pen( 1 ) 16.31.GrayFilter( 1 )
16.5.Stroke( 3 ) 16.32.ImageIcon( 7 )
16.6.Antialiasing( 5 ) 16.33.ImageIO( 26 )
16.9.Arc( 7 ) 16.36.ImageReader( 1 )
16.10.Color( 20 ) 16.37.ImageWriter( 1 )
16.13.Oval( 2 ) 16.40.Clip( 6 )
16.14.Polygon( 2 ) 16.41.Rectangle( 16 )
16.15.Curve( 3 ) 16.42.Dimension( 1 )
16.19.TexturePaint( 3 ) 16.46.AlphaComposite( 12 )
16.21.TextLayout( 8 ) 16.48.PrinterJob( 2 )
16.22.LineBreakMeasurer( 2 ) 16.49.PrintJob( 14 )
16.23.Font( 13 ) 16.50.Print( 13 )
16.25.FontRenderContext( 1 ) 16.52.GraphicsEnvironment( 20 )
16.26.Image( 33 ) 16.53.Animation( 1 )
16.27.BufferedImage( 33 )
17.SWT
17.2.Widget( 15 ) 17.66.CoolBar( 5 )
17.3.Display( 9 ) 17.67.CoolItem( 3 )
17.4.Shell( 26 ) 17.68.CTabFolder( 8 )
17.6.WindowManagers( 1 ) 17.70.ExpandBar( 2 )
17.7.SWT Color( 2 ) 17.71.TabFolder( 3 )
17.9.Button( 17 ) 17.73.ToolTip( 5 )
17.11.Combo( 17 ) 17.75.BusyIndicator( 2 )
17.13.Label( 11 ) 17.77.ControlEditor( 2 )
17.14.CLabel( 9 ) 17.78.DateTime( 2 )
17.15.Text( 16 ) 17.79.Composite( 2 )
17.16.FocusEvent( 2 ) 17.80.ScrolledComposite( 8 )
17.17.Clipboard( 2 ) 17.81.ScrollBar( 3 )
17.19.PasswordField( 1 ) 17.83.Sash( 4 )
17.21.Link( 2 ) 17.85.SashForm( 7 )
17.22.Group( 5 ) 17.86.Browser( 16 )
17.23.List( 15 ) 17.87.ViewForm( 1 )
17.27.Scale( 1 ) 17.91.MouseEvent( 9 )
17.28.Spinner( 2 ) 17.92.TabSequence( 1 )
17.31.MenuEvent( 2 ) 17.95.FillLayout( 4 )
17.32.MenuItem( 8 ) 17.96.GridLayout( 24 )
17.34.PopupMenu( 6 ) 17.98.StackLayout( 4 )
17.35.Tracker( 2 ) 17.99.RowLayout( 12 )
17.39.PopupList( 1 ) 17.103.ColorDialog( 4 )
17.40.MessageBox( 11 ) 17.104.DirectoryDialog( 3 )
17.41.TextLayout( 8 ) 17.105.FileDialog( 8 )
17.42.StyledText( 16 ) 17.106.FontDialog( 2 )
17.48.StatusLine( 1 ) 17.112.PrinterData( 1 )
17.49.Table( 18 ) 17.113.Decorations( 2 )
17.57.Tree( 8 ) 17.121.ImageRegistry( 1 )
17.64.ToolBar( 8 )
18.SWT 2D Graphics
18.2.Color( 2 ) 18.11.Polygon( 1 )
18.6.Arc( 1 ) 18.15.Transform( 4 )
18.7.Oval( 2 ) 18.16.Animation( 2 )
18.8.Sine( 1 ) 18.17.Image( 1 )
19.Network
19.1.URI( 18 ) 19.16.SSLServerSocket( 4 )
19.4.URLDecoder( 21 ) 19.19.DatagramChannel( 2 )
19.6.HttpURLConnection( 27 ) 19.21.Authenticator( 6 )
19.8.NetworkInterface( 8 ) 19.23.Cookie( 3 )
19.9.Socket( 12 ) 19.24.CookieManager( 1 )
19.13.SocketChannel( 7 ) 19.28.PasswordAuthentication( 2 )
19.14.ServerSocket( 13 ) 19.29.Proxy( 1 )
19.15.ServerSocketChannel( 6 )
20.Database
20.4.DataSource( 2 ) 20.24.Column( 4 )
20.14.ParameterMetaData( 2 ) 20.34.MySQL( 21 )
20.16.CallableStatement( 1 ) 20.36.Excel( 5 )
21.Hibernate
21.1.Introduction( 2 ) 21.13.Criteria( 7 )
21.2.Delete( 1 ) 21.14.LogicalExpression( 1 )
21.3.Update( 2 ) 21.15.Projections( 8 )
21.11.HSQL( 14 ) 21.23.Transaction( 2 )
22.JPA
22.2.Persist( 1 ) 22.20.Enum( 3 )
22.3.Find( 1 ) 22.21.Column( 10 )
22.4.Update( 3 ) 22.22.Table( 3 )
22.16.Inheritance( 13 ) 22.34.EntityListener( 7 )
23.JSP
23.2.Variable( 4 ) 23.32.import( 1 )
23.4.String( 3 ) 23.34.Request( 7 )
23.6.If( 4 ) 23.36.forward( 1 )
23.7.Switch( 2 ) 23.37.Include( 3 )
23.8.for( 4 ) 23.38.Cookie( 3 )
23.10.Break( 1 ) 23.40.Session( 4 )
23.13.Operators( 7 ) 23.43.UseBean( 13 )
23.30.Error Page( 4 )
24.JSTL
24.5.Choose( 5 ) 24.23.Header( 1 )
24.6.ForTokens( 2 ) 24.24.import( 2 )
24.9.Set( 11 ) 24.27.Redirect( 1 )
24.12.Cookie( 1 ) 24.30.URL( 2 )
25.Servlet
25.5.Session( 9 ) 25.22.Authentication( 5 )
25.6.Counter( 2 ) 25.23.Buffer( 2 )
25.9.ContextAttributeListener( 1 ) 25.26.Log( 2 )
25.11.ServletContext( 2 ) 25.28.Thread( 1 )
25.13.Response( 5 ) 25.30.web.xml( 6 )
25.15.Redirect( 2 ) 25.32.Email( 1 )
25.16.Forward( 2 ) 25.33.Database( 6 )
25.17.Filter( 8 )
26.2.SOAP( 9 )
27.EJB3
27.7.Resource( 1 ) 27.20.Interceptor( 1 )
27.8.Persistence( 2 ) 27.21.Interceptors( 1 )
28.Spring
28.1.Decouple( 3 ) 28.32.PreparedStatementCallback( 2 )
28.2.ApplicationContext( 8 ) 28.33.PreparedStatementCreator( 2 )
28.3.ApplicationEvent( 1 ) 28.34.PreparedStatementSetter( 3 )
28.11.Singleton( 4 ) 28.42.DAO( 2 )
28.12.ClassPathXmlApplicationContext( 2 ) 28.43.LobHandler( 4 )
28.13.ConfigurableListableBeanFactory( 1 ) 28.44.MappingSqlQuery( 2 )
28.14.ClassPathResource( 3 ) 28.45.SqlFunction( 1 )
28.15.FileSystemXmlApplicationContext( 1 ) 28.46.SqlParameterSource( 1 )
28.16.Resource( 1 ) 28.47.StatementCallback( 1 )
28.17.ResourceBundleMessageSource( 1 ) 28.48.StoredProcedure( 2 )
28.18.DataSource( 7 ) 28.49.ResultSetExtractor( 3 )
28.20.SingleConnectionDataSource( 1 ) 28.51.AfterReturningAdvice( 2 )
28.21.JdbcTemplate( 15 ) 28.52.BeanPostProcessor( 1 )
28.22.JdbcDaoSupport( 2 ) 28.53.Interceptor( 1 )
28.24.SimpleJdbcTemplate( 1 ) 28.55.MethodInterceptor( 4 )
28.25.SimpleJdbcCall( 2 ) 28.56.Pointcut( 9 )
28.26.SimpleJdbcInsert( 1 ) 28.57.ProxyFactory( 3 )
28.27.SqlQuery( 1 ) 28.58.StaticMethodMatcher( 2 )
28.28.SqlRowSet( 1 ) 28.59.TraceInterceptor( 1 )
28.29.SqlUpdate( 5 ) 28.60.Email( 1 )
28.30.CallableStatement( 1 ) 28.61.RMI( 1 )
28.31.CallableStatementCreator( 1 )
29.PDF
29.10.Character( 2 ) 29.49.Path( 3 )
29.11.Symbols( 1 ) 29.50.Shape( 3 )
29.12.Text( 12 ) 29.51.Stroke( 7 )
29.13.Font( 20 ) 29.52.Transparency( 1 )
29.14.Underline( 4 ) 29.53.List( 10 )
29.15.Shading( 3 ) 29.54.Table( 11 )
29.19.Phrase( 1 ) 29.58.TextField( 1 )
29.20.Paragraph( 11 ) 29.59.AcroFields( 2 )
29.21.Chapter( 2 ) 29.60.AcroForm( 2 )
29.24.Column( 9 ) 29.63.Jump( 6 )
29.25.Template( 3 ) 29.64.Embedded Javascript( 2 )
29.26.Document( 1 ) 29.65.EPS( 1 )
29.30.Zoom( 1 ) 29.69.BarcodeEAN( 3 )
29.31.Print( 1 ) 29.70.Layer( 8 )
29.32.Metadata( 6 ) 29.71.Margin( 3 )
29.33.Bookmarks( 5 ) 29.72.Outline( 2 )
29.34.Annotation( 4 ) 29.73.Pattern( 6 )
29.35.Image( 17 ) 29.74.PdfContentByte( 6 )
29.39.PNG Image( 1 )
30.Email
31.J2ME
31.1.MIDlet( 7 ) 31.31.Coordinates( 1 )
31.2.Display( 3 ) 31.32.Clip( 1 )
31.3.Form( 6 ) 31.33.Rectangle( 4 )
31.5.TextBox( 12 ) 31.35.Image( 8 )
31.6.DateField( 5 ) 31.36.PNG( 1 )
31.7.CheckBox( 1 ) 31.37.HttpConnection( 5 )
31.8.RadioButton( 1 ) 31.38.Datagram( 4 )
31.9.ChoiceGroup( 2 ) 31.39.Cookie( 2 )
31.10.Ticker( 1 ) 31.40.Connector( 8 )
31.12.CustomItem( 1 ) 31.42.OutputConnection( 1 )
31.13.ItemStateListener( 1 ) 31.43.ServerSocketConnection( 1 )
31.14.Alert( 3 ) 31.44.StreamConnection( 2 )
31.16.ImageItem( 7 ) 31.46.PIM( 3 )
31.17.Command( 6 ) 31.47.RecordStore( 17 )
31.18.CommandListener( 2 ) 31.48.RecordListener( 1 )
31.20.StopTimeControl( 1 ) 31.50.ToneControl( 1 )
31.21.Timer( 3 ) 31.51.Video( 2 )
31.22.TimerTask( 2 ) 31.52.VideoControl( 1 )
31.23.Thread( 3 ) 31.53.Audio Capture( 2 )
31.27.Arc( 4 ) 31.57.MIDI( 5 )
31.29.Line( 2 ) 31.59.wav( 1 )
31.30.Font( 8 ) 31.60.m3g( 1 )
32.J2EE Application
32.2.Attributes( 1 ) 32.5.SearchControls( 2 )
32.3.Context( 9 )
33.XML
33.1.SAX( 16 ) 33.17.XSLTProcessor( 2 )
33.7.DocumentBuilder( 3 ) 33.23.CDATA( 9 )
33.9.JAXB( 4 ) 33.25.DOCTYPE( 1 )
33.10.StreamFilter( 1 ) 33.26.Namespace( 14 )
33.11.Transformer( 8 ) 33.27.Processing Instruction( 2 )
33.12.XMLInputFactory( 1 ) 33.28.Entities( 3 )
33.13.XMLOutputFactory( 1 ) 33.29.Node( 29 )
33.16.XPath( 7 )
34.Design Pattern
35.Log
35.4.Log Formatter( 8 )
36.Security
36.1.Access Controller( 2 ) 36.26.MD5 Message Digest algorithm ( 16 )
36.4.ASN( 1 ) 36.29.Permission( 21 )
36.7.Certificate( 9 ) 36.32.Principal( 1 )
36.8.CertificateFactory( 4 ) 36.33.PrivilegedAction( 1 )
36.9.CertStore( 1 ) 36.34.Provider( 9 )
36.10.Cipher( 1 ) 36.35.PublicKey( 1 )
36.20.Key( 6 ) 36.45.HTTPS( 9 )
36.22.KeyPairGenerator( 8 ) 36.47.X509Certificate( 6 )
36.23.Keystore( 7 ) 36.48.X509EncodedKeySpec( 1 )
36.24.Keytool( 6 ) 36.49.X.509 Certificate revocation list( 4 )
36.25.Mac( 4 ) 36.50.GuardedObject( 3 )
37.Apache Common
37.1.StringUtils( 16 ) 37.10.ObjectUtils( 5 )
37.3.CompareToBuilder( 1 ) 37.12.RandomUtils( 1 )
37.4.EqualsBuilder( 3 ) 37.13.ExceptionUtils( 1 )
37.5.ClassUtils( 5 ) 37.14.CharSet( 1 )
37.7.DateUtils( 4 ) 37.16.HashCodeBuilder( 4 )
37.8.DateFormatUtils( 8 ) 37.17.StopWatch( 1 )
37.9.NumberUtils( 6 ) 37.18.Fraction( 1 )
38.Ant
38.1.Introduction( 4 ) 38.7.imported( 1 )
38.2.Output( 1 ) 38.8.Condition( 5 )
38.6.Fileset Pattern( 19 )
39.JUnit
39.1.Introduction( 2 ) 39.4.fail( 1 )
39.2.TestCase( 8 ) 39.5.assert( 8 )
Home
Java Tutorial
Language
Data Type
Operators
Statement Control
Class Definition
Development
Reflection
Regular Expressions
Collections
Thread
File
Generics
I18N
Swing
Swing Event
2D Graphics
SWT
SWT 2D Graphics
Network
Database
Hibernate
JPA
JSP
JSTL
Servlet
Web Services SOA
EJB3
Spring
PDF
Email
J2ME
J2EE Application
XML
Design Pattern
Log
Security
Apache Common
Ant
JUnit
Search
Java Tutorial
1. Java Tutorial
2.
1.Language
1.1.Introduction( 17 ) 1.9.Variables( 6 )
1.7.Main( 4 ) 1.15.transient( 1 )
1.8.Garbage Collection( 3 )
2.Data Type
2.2.Boolean( 24 ) 2.26.Quote( 1 )
2.15.Cast( 2 ) 2.39.Calendar( 23 )
2.19.String( 22 ) 2.43.enum( 10 )
2.24.String Tokenize( 3 )
3.Operators
4.Statement Control
5.Class Definition
5.2.Constructor( 7 ) 5.20.New( 2 )
5.9.Varargs( 8 ) 5.27.final( 12 )
5.10.Recursive Method( 6 ) 5.28.Abstract Class( 3 )
5.18.Clone( 18 )
6.Development
6.4.Formatter( 4 ) 6.35.Pack200( 1 )
6.8.RuntimeMXBean( 5 ) 6.39.Desktop( 8 )
6.13.DateFormat( 18 ) 6.44.Clipboard( 12 )
6.14.printf Method( 75 ) 6.45.Console( 5 )
6.19.TimeUnit( 2 ) 6.50.Audio( 15 )
6.21.TimeZone( 15 ) 6.52.JNI( 3 )
6.22.Documentation( 1 ) 6.53.CommPortIdentifier( 4 )
6.23.Exception( 28 ) 6.54.UUID( 11 )
6.24.Assertions( 9 ) 6.55.Robot( 9 )
6.25.Toolkit( 3 ) 6.56.JavaBeans( 36 )
6.26.ProcessBuilder( 2 ) 6.57.Base64( 3 )
6.27.Process( 4 ) 6.58.Cache( 1 )
6.28.Applet( 16 ) 6.59.Debug( 10 )
6.29.JNLP( 2 ) 6.60.JDK( 2 )
6.30.CRC32( 1 ) 6.61.OS( 5 )
7.Reflection
7.1.Class( 19 ) 7.10.Generic( 1 )
7.2.Interface( 11 ) 7.11.ClassPath( 5 )
7.3.Constructor( 14 ) 7.12.Modifier( 16 )
7.6.Package( 13 ) 7.15.PhantomReference( 2 )
7.8.Annotation( 4 ) 7.17.WeakReference( 2 )
7.9.Array( 12 ) 7.18.Proxy( 1 )
8.Regular Expressions
8.3.Group( 4 ) 8.8.Split( 1 )
8.5.Pattern( 13 ) 8.10.Validation( 8 )
9.Collections
9.2.Collections( 22 ) 9.30.NavigableMap( 10 )
9.19.HashSet( 34 ) 9.47.Vector( 60 )
9.25.Map( 16 ) 9.53.Sort( 10 )
9.26.HashMap( 33 ) 9.54.Search( 2 )
9.27.LinkedHashMap( 11 ) 9.55.Collections( 1 )
9.28.Map.Entry( 1 ) 9.56.Reference( 3 )
10.Thread
11.File
11.1.Introduction( 4 ) 11.41.Buffer( 1 )
11.2.File( 45 ) 11.42.ByteBuffer( 31 )
11.3.Path( 29 ) 11.43.CharBuffer( 15 )
11.4.Directory( 35 ) 11.44.DoubleBuffer( 3 )
11.6.Stream( 5 ) 11.46.IntBuffer( 5 )
11.7.InputStream( 15 ) 11.47.LongBuffer( 3 )
11.8.FileInputStream( 18 ) 11.48.ShortBuffer( 2 )
11.9.BufferedInputStream( 8 ) 11.49.MappedByteBuffer( 8 )
11.10.InflaterInputStream( 1 ) 11.50.ByteOrder( 2 )
11.11.SequenceInputStream( 2 ) 11.51.FileChannel( 25 )
11.12.FilterInputStream( 4 ) 11.52.WritableByteChannel( 1 )
11.14.FileOutputStream( 17 ) 11.54.Scanner( 10 )
11.16.OutputStreamWriter( 3 ) 11.56.FileSystemView( 1 )
11.17.DataInputStream( 19 ) 11.57.CharSet( 5 )
11.20.DeflaterOutputStream( 1 ) 11.60.ZipOutputStream( 2 )
11.21.FilterOutputStream( 8 ) 11.61.ZipInputStream( 4 )
11.22.ObjectInputStream( 4 ) 11.62.ZipFile( 15 )
11.23.ObjectOutputStream( 8 ) 11.63.JarFile( 24 )
11.24.ByteArrayOutputStream( 2 ) 11.64.JarOutputStream( 1 )
11.25.ByteArrayInputStream( 1 ) 11.65.GZIPInputStream( 4 )
11.26.PipedInputStream( 1 ) 11.66.GZIPOutputStream( 2 )
11.27.PrintStream( 1 ) 11.67.DeflaterOutputStream( 1 )
11.28.Encoding( 1 ) 11.68.InflaterInputStream( 1 )
11.29.Reader( 11 ) 11.69.Checksum( 8 )
11.31.BufferedReader( 12 ) 11.71.FilenameFilter( 6 )
11.32.Writer( 6 ) 11.72.FileFilter( 10 )
11.33.FileWriter( 4 ) 11.73.FileLock( 3 )
11.34.PrintWriter( 7 ) 11.74.StreamTokenizer( 2 )
11.35.StringReader( 3 ) 11.75.CSV( 7 )
11.39.Externalizable( 3 ) 11.79.Delete( 11 )
11.40.RandomAccessFile( 9 ) 11.80.Text File( 12 )
12.Generics
13.I18N
13.1.Locales( 28 ) 13.13.DecimalFormat( 17 )
13.4.ResourceBundle( 14 ) 13.16.Normalizer( 1 )
13.5.ListResourceBundle( 2 ) 13.17.InputMethod( 1 )
13.6.Applications( 1 ) 13.18.Collator( 5 )
13.9.Calendar( 1 ) 13.21.CharacterIterator( 8 )
13.10.ChoiceFormat( 4 ) 13.22.Collator( 4 )
13.11.Currency( 6 ) 13.23.DateFormatSymbols( 1 )
13.12.Message Format( 18 )
14.Swing
14.2.JComponent( 8 ) 14.66.JTree( 35 )
14.8.JToggleButton( 8 ) 14.72.JToolTip( 20 )
14.9.JRadioButton( 11 ) 14.73.ToolTipManager( 1 )
14.10.ButtonGroup( 3 ) 14.74.JDialog( 14 )
14.11.JCheckBox( 14 ) 14.75.Modality( 6 )
14.12.JComboBox( 33 ) 14.76.JColorChooser( 21 )
14.13.TrayIcon( 7 ) 14.77.JFileChooser( 33 )
14.14.JTextComponent( 41 ) 14.78.JWindow( 5 )
14.18.JFormattedTextField( 26 ) 14.82.Frame( 3 )
14.20.DefaultFormatterFactory( 2 ) 14.84.JRootPane( 6 )
14.21.JMenu( 12 ) 14.85.GlassPane( 2 )
14.22.JMenuBar( 7 ) 14.86.BorderLayout( 6 )
14.23.JMenuItem( 13 ) 14.87.BoxLayout( 15 )
14.24.JCheckBoxMenuItem( 6 ) 14.88.Box( 5 )
14.25.JRadioButtonMenuItem( 2 ) 14.89.FlowLayout( 10 )
14.26.JPopupMenu( 9 ) 14.90.GridLayout( 7 )
14.27.Custom Menu( 1 ) 14.91.OverlayLayout( 3 )
14.28.MenuSelectionManager( 4 ) 14.92.SpringLayout( 11 )
14.29.JSeparator( 4 ) 14.93.CardLayout( 3 )
14.30.JSlider( 40 ) 14.94.GridBagLayout( 18 )
14.31.BoundedRangeModel( 2 ) 14.95.GridBagConstraints( 12 )
14.32.JProgressBar( 15 ) 14.96.GroupLayout( 1 )
14.35.JEditorPane( 7 ) 14.99.AbstractBorder( 5 )
14.38.JTextPane( 41 ) 14.102.BevelBorder( 5 )
14.39.SimpleAttributeSet( 5 ) 14.103.SoftBevelBorder( 3 )
14.40.JList( 30 ) 14.104.CompoundBorder( 3 )
14.45.JPanel( 8 ) 14.109.BorderFactory( 16 )
14.46.JScrollPane( 15 ) 14.110.ProgressMonitor( 7 )
14.47.ScrollPaneLayout( 1 ) 14.111.ProgressMonitorInputStream( 1 )
14.51.JTabbedPane( 33 ) 14.115.Cursor( 4 )
14.52.JLayeredPane( 4 ) 14.116.Icon( 9 )
14.54.JDesktopPane( 8 ) 14.118.SystemColor( 1 )
14.57.JToolBar( 14 ) 14.121.UIDefault( 7 )
14.58.JTable( 59 ) 14.122.UIManager( 4 )
14.61.JTableHeader( 11 ) 14.125.SwingWorker( 4 )
14.64.JTable Filter( 4 )
15.Swing Event
15.1.Event( 17 ) 15.23.ListDataListener( 2 )
15.3.Action( 11 ) 15.25.MenuDragMouseListener( 1 )
15.4.InputMap( 10 ) 15.26.MenuKeyListener( 1 )
15.5.ActionListener( 10 ) 15.27.MenuListener( 2 )
15.7.AncestorListener( 1 ) 15.29.MouseListener( 3 )
15.8.CaretListener( 2 ) 15.30.MouseMotionListener( 4 )
15.9.ChangeListener( 6 ) 15.31.MouseWheelListener( 3 )
15.10.ComponentListener( 6 ) 15.32.PopupMenuListener( 1 )
15.11.ContainerListener( 4 ) 15.33.PropertyChangeListener( 1 )
15.13.DocumentListener( 4 ) 15.35.TableModelListener( 1 )
15.15.Focus( 31 ) 15.37.TreeModelListener( 1 )
15.16.FocusListener( 7 ) 15.38.TreeSelectionListener( 5 )
15.17.HierarchyListener( 1 ) 15.39.TreeWillExpandListener( 2 )
15.18.HyperlinkListener( 2 ) 15.40.VetoableChangeListener( 2 )
15.20.ItemListener( 5 ) 15.42.WindowFocusListener( 2 )
15.21.KeyListener( 12 ) 15.43.WindowStateListener( 1 )
15.22.KeyStroke( 22 )
16.2D Graphics
16.1.Repaint( 1 ) 16.28.GIF( 2 )
16.2.Graphics( 8 ) 16.29.JPEG( 2 )
16.3.Tranformation( 13 ) 16.30.PNG( 1 )
16.4.Pen( 1 ) 16.31.GrayFilter( 1 )
16.5.Stroke( 3 ) 16.32.ImageIcon( 7 )
16.6.Antialiasing( 5 ) 16.33.ImageIO( 26 )
16.9.Arc( 7 ) 16.36.ImageReader( 1 )
16.10.Color( 20 ) 16.37.ImageWriter( 1 )
16.12.Line( 12 ) 16.39.Point( 3 )
16.13.Oval( 2 ) 16.40.Clip( 6 )
16.14.Polygon( 2 ) 16.41.Rectangle( 16 )
16.15.Curve( 3 ) 16.42.Dimension( 1 )
16.19.TexturePaint( 3 ) 16.46.AlphaComposite( 12 )
16.21.TextLayout( 8 ) 16.48.PrinterJob( 2 )
16.22.LineBreakMeasurer( 2 ) 16.49.PrintJob( 14 )
16.23.Font( 13 ) 16.50.Print( 13 )
16.25.FontRenderContext( 1 ) 16.52.GraphicsEnvironment( 20 )
16.26.Image( 33 ) 16.53.Animation( 1 )
16.27.BufferedImage( 33 )
17.SWT
17.2.Widget( 15 ) 17.66.CoolBar( 5 )
17.3.Display( 9 ) 17.67.CoolItem( 3 )
17.4.Shell( 26 ) 17.68.CTabFolder( 8 )
17.6.WindowManagers( 1 ) 17.70.ExpandBar( 2 )
17.9.Button( 17 ) 17.73.ToolTip( 5 )
17.11.Combo( 17 ) 17.75.BusyIndicator( 2 )
17.13.Label( 11 ) 17.77.ControlEditor( 2 )
17.14.CLabel( 9 ) 17.78.DateTime( 2 )
17.15.Text( 16 ) 17.79.Composite( 2 )
17.16.FocusEvent( 2 ) 17.80.ScrolledComposite( 8 )
17.17.Clipboard( 2 ) 17.81.ScrollBar( 3 )
17.19.PasswordField( 1 ) 17.83.Sash( 4 )
17.21.Link( 2 ) 17.85.SashForm( 7 )
17.22.Group( 5 ) 17.86.Browser( 16 )
17.23.List( 15 ) 17.87.ViewForm( 1 )
17.27.Scale( 1 ) 17.91.MouseEvent( 9 )
17.28.Spinner( 2 ) 17.92.TabSequence( 1 )
17.30.Menu( 5 ) 17.94.FormLayout( 24 )
17.31.MenuEvent( 2 ) 17.95.FillLayout( 4 )
17.32.MenuItem( 8 ) 17.96.GridLayout( 24 )
17.34.PopupMenu( 6 ) 17.98.StackLayout( 4 )
17.35.Tracker( 2 ) 17.99.RowLayout( 12 )
17.39.PopupList( 1 ) 17.103.ColorDialog( 4 )
17.40.MessageBox( 11 ) 17.104.DirectoryDialog( 3 )
17.41.TextLayout( 8 ) 17.105.FileDialog( 8 )
17.42.StyledText( 16 ) 17.106.FontDialog( 2 )
17.48.StatusLine( 1 ) 17.112.PrinterData( 1 )
17.49.Table( 18 ) 17.113.Decorations( 2 )
17.57.Tree( 8 ) 17.121.ImageRegistry( 1 )
17.64.ToolBar( 8 )
18.SWT 2D Graphics
18.2.Color( 2 ) 18.11.Polygon( 1 )
18.6.Arc( 1 ) 18.15.Transform( 4 )
18.7.Oval( 2 ) 18.16.Animation( 2 )
18.8.Sine( 1 ) 18.17.Image( 1 )
19.Network
19.1.URI( 18 ) 19.16.SSLServerSocket( 4 )
19.4.URLDecoder( 21 ) 19.19.DatagramChannel( 2 )
19.6.HttpURLConnection( 27 ) 19.21.Authenticator( 6 )
19.8.NetworkInterface( 8 ) 19.23.Cookie( 3 )
19.9.Socket( 12 ) 19.24.CookieManager( 1 )
19.13.SocketChannel( 7 ) 19.28.PasswordAuthentication( 2 )
19.14.ServerSocket( 13 ) 19.29.Proxy( 1 )
19.15.ServerSocketChannel( 6 )
20.Database
20.14.ParameterMetaData( 2 ) 20.34.MySQL( 21 )
20.16.CallableStatement( 1 ) 20.36.Excel( 5 )
21.Hibernate
21.1.Introduction( 2 ) 21.13.Criteria( 7 )
21.2.Delete( 1 ) 21.14.LogicalExpression( 1 )
21.3.Update( 2 ) 21.15.Projections( 8 )
21.11.HSQL( 14 ) 21.23.Transaction( 2 )
22.JPA
22.2.Persist( 1 ) 22.20.Enum( 3 )
22.3.Find( 1 ) 22.21.Column( 10 )
22.4.Update( 3 ) 22.22.Table( 3 )
23.JSP
23.2.Variable( 4 ) 23.32.import( 1 )
23.4.String( 3 ) 23.34.Request( 7 )
23.6.If( 4 ) 23.36.forward( 1 )
23.7.Switch( 2 ) 23.37.Include( 3 )
23.8.for( 4 ) 23.38.Cookie( 3 )
23.10.Break( 1 ) 23.40.Session( 4 )
23.13.Operators( 7 ) 23.43.UseBean( 13 )
23.30.Error Page( 4 )
24.JSTL
24.5.Choose( 5 ) 24.23.Header( 1 )
24.6.ForTokens( 2 ) 24.24.import( 2 )
24.9.Set( 11 ) 24.27.Redirect( 1 )
24.12.Cookie( 1 ) 24.30.URL( 2 )
25.Servlet
25.4.Cookie( 7 ) 25.21.Path( 2 )
25.5.Session( 9 ) 25.22.Authentication( 5 )
25.6.Counter( 2 ) 25.23.Buffer( 2 )
25.9.ContextAttributeListener( 1 ) 25.26.Log( 2 )
25.10.ContextListener( 1 ) 25.27.Refresh Client( 2 )
25.11.ServletContext( 2 ) 25.28.Thread( 1 )
25.13.Response( 5 ) 25.30.web.xml( 6 )
25.15.Redirect( 2 ) 25.32.Email( 1 )
25.16.Forward( 2 ) 25.33.Database( 6 )
25.17.Filter( 8 )
26.2.SOAP( 9 )
27.EJB3
27.7.Resource( 1 ) 27.20.Interceptor( 1 )
27.8.Persistence( 2 ) 27.21.Interceptors( 1 )
28.Spring
28.1.Decouple( 3 ) 28.32.PreparedStatementCallback( 2 )
28.2.ApplicationContext( 8 ) 28.33.PreparedStatementCreator( 2 )
28.3.ApplicationEvent( 1 ) 28.34.PreparedStatementSetter( 3 )
28.11.Singleton( 4 ) 28.42.DAO( 2 )
28.12.ClassPathXmlApplicationContext( 2 ) 28.43.LobHandler( 4 )
28.13.ConfigurableListableBeanFactory( 1 ) 28.44.MappingSqlQuery( 2 )
28.14.ClassPathResource( 3 ) 28.45.SqlFunction( 1 )
28.15.FileSystemXmlApplicationContext( 1 ) 28.46.SqlParameterSource( 1 )
28.16.Resource( 1 ) 28.47.StatementCallback( 1 )
28.17.ResourceBundleMessageSource( 1 ) 28.48.StoredProcedure( 2 )
28.18.DataSource( 7 ) 28.49.ResultSetExtractor( 3 )
28.20.SingleConnectionDataSource( 1 ) 28.51.AfterReturningAdvice( 2 )
28.21.JdbcTemplate( 15 ) 28.52.BeanPostProcessor( 1 )
28.22.JdbcDaoSupport( 2 ) 28.53.Interceptor( 1 )
28.24.SimpleJdbcTemplate( 1 ) 28.55.MethodInterceptor( 4 )
28.25.SimpleJdbcCall( 2 ) 28.56.Pointcut( 9 )
28.26.SimpleJdbcInsert( 1 ) 28.57.ProxyFactory( 3 )
28.27.SqlQuery( 1 ) 28.58.StaticMethodMatcher( 2 )
28.28.SqlRowSet( 1 ) 28.59.TraceInterceptor( 1 )
28.29.SqlUpdate( 5 ) 28.60.Email( 1 )
28.30.CallableStatement( 1 ) 28.61.RMI( 1 )
28.31.CallableStatementCreator( 1 )
29.PDF
29.10.Character( 2 ) 29.49.Path( 3 )
29.11.Symbols( 1 ) 29.50.Shape( 3 )
29.12.Text( 12 ) 29.51.Stroke( 7 )
29.13.Font( 20 ) 29.52.Transparency( 1 )
29.14.Underline( 4 ) 29.53.List( 10 )
29.15.Shading( 3 ) 29.54.Table( 11 )
29.19.Phrase( 1 ) 29.58.TextField( 1 )
29.20.Paragraph( 11 ) 29.59.AcroFields( 2 )
29.21.Chapter( 2 ) 29.60.AcroForm( 2 )
29.24.Column( 9 ) 29.63.Jump( 6 )
29.26.Document( 1 ) 29.65.EPS( 1 )
29.30.Zoom( 1 ) 29.69.BarcodeEAN( 3 )
29.31.Print( 1 ) 29.70.Layer( 8 )
29.32.Metadata( 6 ) 29.71.Margin( 3 )
29.33.Bookmarks( 5 ) 29.72.Outline( 2 )
29.34.Annotation( 4 ) 29.73.Pattern( 6 )
29.35.Image( 17 ) 29.74.PdfContentByte( 6 )
29.39.PNG Image( 1 )
30.Email
31.J2ME
31.1.MIDlet( 7 ) 31.31.Coordinates( 1 )
31.2.Display( 3 ) 31.32.Clip( 1 )
31.3.Form( 6 ) 31.33.Rectangle( 4 )
31.5.TextBox( 12 ) 31.35.Image( 8 )
31.6.DateField( 5 ) 31.36.PNG( 1 )
31.7.CheckBox( 1 ) 31.37.HttpConnection( 5 )
31.8.RadioButton( 1 ) 31.38.Datagram( 4 )
31.9.ChoiceGroup( 2 ) 31.39.Cookie( 2 )
31.10.Ticker( 1 ) 31.40.Connector( 8 )
31.11.List( 6 ) 31.41.Servlet Invoke( 2 )
31.12.CustomItem( 1 ) 31.42.OutputConnection( 1 )
31.13.ItemStateListener( 1 ) 31.43.ServerSocketConnection( 1 )
31.14.Alert( 3 ) 31.44.StreamConnection( 2 )
31.16.ImageItem( 7 ) 31.46.PIM( 3 )
31.17.Command( 6 ) 31.47.RecordStore( 17 )
31.18.CommandListener( 2 ) 31.48.RecordListener( 1 )
31.20.StopTimeControl( 1 ) 31.50.ToneControl( 1 )
31.21.Timer( 3 ) 31.51.Video( 2 )
31.22.TimerTask( 2 ) 31.52.VideoControl( 1 )
31.27.Arc( 4 ) 31.57.MIDI( 5 )
31.29.Line( 2 ) 31.59.wav( 1 )
31.30.Font( 8 ) 31.60.m3g( 1 )
32.J2EE Application
32.2.Attributes( 1 ) 32.5.SearchControls( 2 )
32.3.Context( 9 )
33.XML
33.1.SAX( 16 ) 33.17.XSLTProcessor( 2 )
33.7.DocumentBuilder( 3 ) 33.23.CDATA( 9 )
33.9.JAXB( 4 ) 33.25.DOCTYPE( 1 )
33.10.StreamFilter( 1 ) 33.26.Namespace( 14 )
33.12.XMLInputFactory( 1 ) 33.28.Entities( 3 )
33.13.XMLOutputFactory( 1 ) 33.29.Node( 29 )
33.16.XPath( 7 )
34.Design Pattern
35.Log
35.4.Log Formatter( 8 )
36.Security
36.4.ASN( 1 ) 36.29.Permission( 21 )
36.7.Certificate( 9 ) 36.32.Principal( 1 )
36.8.CertificateFactory( 4 ) 36.33.PrivilegedAction( 1 )
36.9.CertStore( 1 ) 36.34.Provider( 9 )
36.10.Cipher( 1 ) 36.35.PublicKey( 1 )
36.20.Key( 6 ) 36.45.HTTPS( 9 )
36.22.KeyPairGenerator( 8 ) 36.47.X509Certificate( 6 )
36.23.Keystore( 7 ) 36.48.X509EncodedKeySpec( 1 )
36.25.Mac( 4 ) 36.50.GuardedObject( 3 )
37.Apache Common
37.1.StringUtils( 16 ) 37.10.ObjectUtils( 5 )
37.3.CompareToBuilder( 1 ) 37.12.RandomUtils( 1 )
37.4.EqualsBuilder( 3 ) 37.13.ExceptionUtils( 1 )
37.5.ClassUtils( 5 ) 37.14.CharSet( 1 )
37.7.DateUtils( 4 ) 37.16.HashCodeBuilder( 4 )
37.8.DateFormatUtils( 8 ) 37.17.StopWatch( 1 )
37.9.NumberUtils( 6 ) 37.18.Fraction( 1 )
38.Ant
38.1.Introduction( 4 ) 38.7.imported( 1 )
38.2.Output( 1 ) 38.8.Condition( 5 )
38.6.Fileset Pattern( 19 )
39.JUnit
39.1.Introduction( 2 ) 39.4.fail( 1 )
39.2.TestCase( 8 ) 39.5.assert( 8 )
ADVANCED
We can use the default constructor of the Thread class to create a Thread object.
We must call its start() method to start the thread represented by that object.
simplestThread.start();
Logic for Thread
There are three ways you can specify your code to be executed by a thread:
When we inherit class from the Thread class, we should override the run() method and
provide the code to be executed by the thread.
@Override
myThread.start();
The thread will execute the run() method of the MyThreadClass class.
Implementing the Runnable Interface
@FunctionalInterface
void run();
From Java 8, we can use a lambda expression to create an instance of the Runnable
interface.
Create an object of the Thread class using the constructor that accepts a Runnable
object.
Start the thread by calling the start() method of the thread object.
myThread.start();
The thread will execute the code contained in the body of the lambda expressions.
From Java 8, we can use the method reference of a method of any class that takes no
parameters and returns void as the code to be executed by a thread.
The following code declares a ThreadTest class that contains an execute() method.
The following code uses the method reference of the execute() method of the
ThreadTest class to create a Runnable object:
myThread.start();
The thread will execute the code contained in the execute() method of the ThreadTest
class.
The following code shows how to create a thread and print integers from 1 to 5 on the
standard output.
//from w ww .j a v a2 s . c o m
t.start();
Next »
The host argument refers to a computer name or an IP address. The addr argument
refers to the parts of an IP address as a byte array.
The InetAddress class can resolve the host name to an IP address using DNS.
Example
import java.net.InetAddress;
// w w w.ja v a2 s .c o m
printAddressDetails("www.yahoo.com");
printAddressDetails(null);
printAddressDetails("::1");
+ addr.getCanonicalHostName());
System.out.println("isReachable(): "
+ addr.isReachable(timeOutinMillis));
Socket Address
InetSocketAddress(int port)
If a host name could not be resolved, the socket address will be unresolved, which
can be checked using the isUnresolved() method.
To not resolve the address when creating its object, use the following factory
method to create the socket address:
import java.net.InetSocketAddress;
// w w w. ja va 2s. co m
printSocketAddress(addr1);
12881);
printSocketAddress(addr2);
}
System.out.println();