Java Tutorial links
Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. This tutorial gives a complete understanding on Java. |
The Java Tutorials On
Dear students, Your use of this page http://docs.oracle.com/javase/tutorial and all the material on pages under "The Java Tutorials" banner is subject to the Terms of Use. Additionally, any example code contained in any of these Java Tutorials pages is also licensed under the Code Sample License.A list of all content pages in the The Java™ Tutorials
- Variables
- Primitive Data Types
- Arrays
- Summary of Variables
- Questions and Exercises: Variables
- Operators
- Assignment, Arithmetic, and Unary Operators
- Equality, Relational, and Conditional Operators
- Bitwise and Bit Shift Operators
- Summary of Operators
- Questions and Exercises: Operators
- Expressions, Statements, and Blocks
- Questions and Exercises: Expressions, Statements, and Blocks
- Control Flow Statements
- The if-then and if-then-else Statements
- The switch Statement
- The while and do-while Statements
- The for Statement
- Branching Statements
- Summary of Control Flow Statements
- Questions and Exercises: Control Flow Statements
- Classes
- Declaring Classes
- Declaring Member Variables
- Defining Methods
- Providing Constructors for Your Classes
- Passing Information to a Method or a Constructor
- Objects
- Creating Objects
- Using Objects
- More on Classes
- Returning a Value from a Method
- Using the this Keyword
- Controlling Access to Members of a Class
- Understanding Instance and Class Members
- Initializing Fields
- Summary of Creating and Using Classes and Objects
- Questions and Exercises: Classes
- Questions and Exercises: Objects
- Nested Classes
- Inner Class Example
- Summary of Nested Classes
- Questions and Exercises: Nested Classes
- Enum Types
- Questions and Exercises: Enum Types
- Annotations
- Questions and Exercises: Annotations
- Interfaces
- Defining an Interface
- Implementing an Interface
- Using an Interface as a Type
- Rewriting Interfaces
- Summary of Interfaces
- Questions and Exercises: Interfaces
- Inheritance
- Overriding and Hiding Methods
- Polymorphism
- Hiding Fields
- Using the Keyword super
- Object as a Superclass
- Writing Final Classes and Methods
- Abstract Methods and Classes
- Summary of Inheritance
- Questions and Exercises: Inheritance
- Numbers
- The Numbers Classes
- Formatting Numeric Print Output
- Beyond Basic Arithmetic
- Summary of Numbers
- Questions and Exercises: Numbers
- Characters
- Strings
- Converting Between Numbers and Strings
- Manipulating Characters in a String
- Comparing Strings and Portions of Strings
- The StringBuilder Class
- Summary of Characters and Strings
- Autoboxing and Unboxing
- Questions and Exercises: Characters and Strings
- Why Use Generics?
- Generic Types
- Raw Types
- Generic Methods
- Bounded Type Parameters
- Generic Methods and Bounded Type Parameters
- Generics, Inheritance, and Subtypes
- Type Inference
- Wildcards
- Upper Bounded Wildcards
- Unbounded Wildcards
- Lower Bounded Wildcards
- Wildcards and Subtyping
- Wildcard Capture and Helper Methods
- Guidelines for Wildcard Use
- Type Erasure
- Erasure of Generic Types
- Erasure of Generic Methods
- Effects of Type Erasure and Bridge Methods
- Non-Reifiable Types
- Restrictions on Generics
- Questions and Exercises: Generics
Trail: Learning the Java Language
- Language Basics
- Classes and Objects
- Interfaces and Inheritance
- Numbers and Strings
- Generics (Updated)
- What Is an Exception?
- The Catch or Specify Requirement
- Catching and Handling Exceptions
- The try Block
- The catch Blocks
- The finally Block
- The try-with-resources Statement
- Putting It All Together
- Specifying the Exceptions Thrown by a Method
- How to Throw Exceptions
- Chained Exceptions
- Creating Exception Classes
- Unchecked Exceptions — The Controversy
- Advantages of Exceptions
- Summary
- Questions and Exercises
- I/O Streams
- Byte Streams
- Character Streams
- Buffered Streams
- Scanning and Formatting
- Scanning
- Formatting
- I/O from the Command Line
- Data Streams
- Object Streams
- File I/O (Featuring NIO.2)
- What Is a Path? (And Other File System Facts)
- The Path Class
- Path Operations
- File Operations
- Checking a File or Directory
- Deleting a File or Directory
- Copying a File or Directory
- Moving a File or Directory
- Managing Metadata (File and File Store Attributes)
- Reading, Writing, and Creating Files
- Random Access Files
- Creating and Reading Directories
- Links, Symbolic or Otherwise
- Walking the File Tree
- Finding Files
- Watching a Directory for Changes
- Other Useful Methods
- Legacy File I/O Code
- Summary
- Questions and Exercises: Basic I/O
- Processes and Threads
- Thread Objects
- Defining and Starting a Thread
- Pausing Execution with Sleep
- Interrupts
- Joins
- The SimpleThreads Example
- Synchronization
- Thread Interference
- Memory Consistency Errors
- Synchronized Methods
- Intrinsic Locks and Synchronization
- Atomic Access
- Liveness
- Deadlock
- Starvation and Livelock
- Guarded Blocks
- Immutable Objects
- A Synchronized Class Example
- A Strategy for Defining Immutable Objects
- High Level Concurrency Objects
- Lock Objects
- Executors
- Executor Interfaces
- Thread Pools
- Fork/Join
- Concurrent Collections
- Atomic Variables
- Concurrent Random Numbers
- For Further Reading
- Questions and Exercises: Concurrency
- Introduction
- Test Harness
- String Literals
- Character Classes
- Predefined Character Classes
- Quantifiers
- Capturing Groups
- Boundary Matchers
- Methods of the Pattern Class
- Methods of the Matcher Class
- Methods of the PatternSyntaxException Class
- Unicode Support
- Additional Resources
- Questions and Exercises: Regular Expressions
Trail: Essential Classes
- Exceptions
- Basic I/O
- Concurrency
- Regular Expressions
- Getting Started With Applets
- Defining an Applet Subclass
- Methods for Milestones
- Life Cycle of an Applet
- Applet's Execution Environment
- Developing an Applet
- Deploying an Applet
- Deploying With the Applet Tag
- Doing More With Applets
- Finding and Loading Data Files
- Defining and Using Applet Parameters
- Displaying Short Status Strings
- Displaying Documents in the Browser
- Invoking JavaScript Code From an Applet
- Invoking Applet Methods From JavaScript Code
- Handling Initialization Status With Event Handlers
- Manipulating DOM of Applet's Web Page
- Displaying a Customized Loading Progress Indicator
- Writing Diagnostics to Standard Output and Error Streams
- Developing Draggable Applets
- Communicating With Other Applets
- Working With a Server-Side Application
- Network Client Applet Example
- What Applets Can and Cannot Do
- Solving Common Applet Problems
- Questions and Exercises: Applets
- Developing a Java Web Start Application
- Retrieving Resources
- Deploying a Java Web Start Application
- Setting Up a Web Server
- Displaying a Customized Loading Progress Indicator
- Running a Java Web Start Application
- Java Web Start and Security
- Common Java Web Start Problems
- Questions and Exercises: Java Web Start
- Deployment Toolkit
- Deploying an Applet
- Customizing the Loading Screen
- Embedding JNLP File in Applet Tag
- Deploying a Java Web Start Application
- Changing the Launch Button
- Deploying Without Codebase
- Checking the Client JRE Software Version
- Java Network Launch Protocol
- Structure of the JNLP File
- Deployment Best Practices
- Reducing the Download Time
- Avoiding Unnecessary Update Checks
- Signing JAR Files Only When Necessary
- Ensuring the Presence of the JRE Software
- Questions and Exercises: Deployment In-Depth
- Using JAR Files: The Basics
- Creating a JAR File
- Viewing the Contents of a JAR File
- Extracting the Contents of a JAR File
- Updating a JAR File
- Running JAR-Packaged Software
- Working with Manifest Files: The Basics
- Understanding the Default Manifest
- Modifying a Manifest File
- Setting an Application's Entry Point
- Adding Classes to the JAR File's Classpath
- Setting Package Version Information
- Sealing Packages within a JAR File
- Signing and Verifying JAR Files
- Understanding Signing and Verification
- Signing JAR Files
- Verifying Signed JAR Files
- Using JAR-related APIs
- The JarClassLoader Class
- The JarRunner Class
- Questions and Exercises: JAR
Trail: Deployment
- Java Applets
- Java Web Start
- Deployment In-Depth
- Packaging Programs in JAR Files
- A Visual Guide to Swing Components (Java Look and Feel)
- A Visual Guide to Swing Components (Windows Look and Feel)
- Pluggable Look and Feel
- Data Transfer
- Internationalization and Localization
- Accessibility
- Integrating with the Desktop
- System Tray Icon Support
- Questions and Exercises: Graphical User Interfaces
Trail: Graphical User Interfaces
- Swing Features
- Using Top-Level Containers
- The JComponent Class
- Using Text Components
- Text Component Features
- The Text Component API
- How to Use Various Components
- How to Make Applets
- How to Use Buttons, Check Boxes, and Radio Buttons
- How to Use the ButtonGroup Component
- How to Use Color Choosers
- How to Use Combo Boxes
- How to Make Dialogs
- How to Use Editor Panes and Text Panes
- How to Use File Choosers
- How to Use Formatted Text Fields
- How to Make Frames (Main Windows)
- How to Use Internal Frames
- How to Use Labels
- How to Use Layered Panes
- How to Use Lists
- How to Use Menus
- How to Use Panels
- How to Use Password Fields
- How to Use Progress Bars
- How to Use Root Panes
- How to Use Scroll Panes
- How to Use Separators
- How to Use Sliders
- How to Use Spinners
- How to Use Split Panes
- How to Use Tabbed Panes
- How to Use Tables
- How to Use Text Areas
- How to Use Text Fields
- How to Use Tool Bars
- How to Use Tool Tips
- How to Use Trees
- How to Use HTML in Swing Components
- How to Use Models
- How to Use Icons
- How to Use Borders
- Solving Common Component Problems
- Questions and Exercises: Using Swing Components
- How to Integrate with the Desktop Class
- How to Create Translucent and Shaped Windows
- How to Decorate Components with the JLayer Class
- How to Use Actions
- How to Use Swing Timers
- How to Support Assistive Technologies
- How to Use the Focus Subsystem
- How to Use Key Bindings
- How to Use Modality in Dialogs
- How to Print Tables
- How to Print Text
- How to Create a Splash Screen
- How to Use the System Tray
- Solving Common Problems Using Other Swing Features
- A Visual Guide to Layout Managers
- Using Layout Managers
- How Layout Management Works
- How to Use Various Layout Managers
- How to Use BorderLayout
- How to Use BoxLayout
- How to Use CardLayout
- How to Use FlowLayout
- How to Use GridBagLayout
- How to Use GridLayout
- How to Use GroupLayout
- A GroupLayout Example
- How to Use SpringLayout
- Creating a Custom Layout Manager
- Doing Without a Layout Manager (Absolute Positioning)
- Solving Common Layout Problems
- Questions and Exercises: Laying Out Components within a Container
- Introduction to DnD
- Default DnD Support
- Demo - BasicDnD
- TransferHandler Class
- Export Methods
- Import Methods
- TransferSupport Class
- Setting the Drop Mode
- Demo - DropDemo
- Choosing the Drop Action
- Demo - ChooseDropAction
- Showing the Drop Location
- Location Sensitive Drop
- Demo - LocationSensitiveDemo
- Empty Table Drop
- Drop Location Rendering
- Top-Level Drop
- Adding Cut, Copy and Paste (CCP)
- CCP in a Text Component
- CCP in a non-Text Component
- Using and Creating a DataFlavor
- Putting it All Together - DnD and CCP
- Further Information
- Solving Common Data Transfer Problems
- Introduction to Event Listeners
- General Information about Writing Event Listeners
- Listeners Supported by Swing Components
- Implementing Listeners for Commonly Handled Events
- How to Write an Action Listener
- How to Write a Caret Listener
- How to Write a Change Listener
- How to Write a Component Listener
- How to Write a Container Listener
- How to Write a Document Listener
- How to Write a Focus Listener
- How to Write an Internal Frame Listener
- How to Write an Item Listener
- How to Write a Key Listener
- How to Write a List Data Listener
- How to Write a List Selection Listener
- How to Write a Mouse Listener
- How to Write a Mouse-Motion Listener
- How to Write a Mouse-Wheel Listener
- How to Write a Property Change Listener
- How to Write a Table Model Listener
- How to Write a Tree Expansion Listener
- How to Write a Tree Model Listener
- How to Write a Tree Selection Listener
- How to Write a Tree-Will-Expand Listener
- How to Write an Undoable Edit Listener
- How to Write Window Listeners
- Listener API Table
- Solving Common Event-Handling Problems
- Questions and Exercises: Writing Event Listeners
Trail: Creating a GUI With JFC/Swing
- Using Swing Components
- Using Other Swing Features
- Laying Out Components Within a Container
- Drag and Drop and Data Transfer
- Writing Event Listeners
- Checking Character Properties
- Comparing Strings
- Performing Locale-Independent Comparisons
- Customizing Collation Rules
- Improving Collation Performance
- Unicode
- Terminology
- Supplementary Characters as Surrogates
- Character and String APIs
- Sample Usage
- Design Considerations
- More Information
- Detecting Text Boundaries
- About the BreakIterator Class
- Character Boundaries
- Word Boundaries
- Sentence Boundaries
- Line Boundaries
- Converting Latin Digits to Other Unicode Digits
- Converting Non-Unicode Text
- Byte Encodings and Strings
- Character and Byte Streams
- Normalizing Text
- Working with Bidirectional Text with the JTextComponent Class
Trail: Internationalization
- Working with Text
Trail: 2D Graphics
- Overview of the Sampled Package
- Accessing Audio System Resources
- Playing Back Audio
- Capturing Audio
- Processing Audio with Controls
- Using Files and Format Converters
- Overview of the MIDI Package
- Accessing MIDI System Resources
- Transmitting and Receiving MIDI Messages
- Introduction to Sequencers
- Using Sequencer Methods
- Using Advanced Sequencer Features
- Synthesizing Sound
- Introduction to the Service Provider Interfaces
- Providing Sampled-Audio Services
- Providing MIDI Services
Trail: Sound
- Getting Started
- Processing SQL Statements with JDBC
- Establishing a Connection
- Connecting with DataSource Objects
- Handling SQLExceptions
- Setting Up Tables
- Retrieving and Modifying Values from Result Sets
- Using Prepared Statements
- Using Transactions
- Using RowSet Objects
- Using JdbcRowSet Objects
- Using CachedRowSetObjects
- Using JoinRowSet Objects
- Using FilteredRowSet Objects
- Using WebRowSet Objects
- Using Advanced Data Types
- Using Large Objects
- Using SQLXML Objects
- Using Array Objects
- Using DISTINCT Data Type
- Using Structured Objects
- Using Customized Type Mappings
- Using Datalink Objects
- Using RowId Objects
- Using Stored Procedures
- Using JDBC with GUI API
Trail: JDBC(TM) Database Access
- JDBC Basics
Trail: Java API for XML Processing (JAXP)
- Steps for the Code Signer
- Download and Try the Sample Application
- Create a JAR File Containing the Class File
- Generate Keys
- Sign the JAR File
- Export the Public Key Certificate
- Steps for the Code Receiver
- Observe the Restricted Application
- Import the Certificate as a Trusted Certificate
- Set Up a Policy File to Grant the Required Permission
- Start Policy Tool
- Specify the Keystore
- Add a Policy Entry with a SignedBy Alias
- Save the Policy File
- See the Policy File Effects
- Generating a Digital Signature
- Prepare Initial Program Structure
- Generate Public and Private Keys
- Sign the Data
- Save the Signature and the Public Key in Files
- Compile and Run the Program
- Verifying a Digital Signature
- Prepare Initial Program Structure
- Input and Convert the Encoded Public Key Bytes
- Input the Signature Bytes
- Verify the Signature
- Compile and Run the Program
- Weaknesses and Alternatives
Trail: Security Features in Java SE
- Signing Code and Granting It Permissions
- Generating and Verifying Signatures
- Fields
- Obtaining Field Types
- Retrieving and Parsing Field Modifiers
- Getting and Setting Field Values
- Troubleshooting
- Methods
- Obtaining Method Type Information
- Retrieving and Parsing Method Modifiers
- Invoking Methods
- Troubleshooting
- Constructors
- Finding Constructors
- Retrieving and Parsing Constructor Modifiers
- Creating New Class Instances
- Troubleshooting
Trail: The Reflection API
- Members
Trail: Custom Networking
- LDAP v3
- JNDI as an LDAP API
- How LDAP Operations Map to JNDI APIs
- How LDAP Error Codes Map to JNDI Exceptions
- Security
- Modes of Authenticating to LDAP
- Authentication Mechanisms
- Anonymous
- Simple
- SASL
- Digest-MD5
- SSL and Custom Sockets
- More LDAP Operations
- LDAP Compare
- Search Results
- LDAP Unsolicited Notifications
- Connection Management
- Creation
- Closing
- Pooling
- Configuration
- Frequently Asked Questions
Trail: Java Naming and Directory Interface
- Advanced Topics for LDAP Users
Trail: Java Architecture for XML Binding
Creating Graphical User Interfaces
- Creating a GUI with Swing — A comprehensive introduction to GUI creation on the Java platform.
- Creating a JavaFX GUI — A collection of JavaFX tutorials.
Specialized Trails and Lessons
These trails and lessons are only available as web pages.- Custom Networking — An introduction to the Java platform's powerful networking features.
- The Extension Mechanism — How to make custom APIs available to all applications running on the Java platform.
- Full-Screen Exclusive Mode API — How to write applications that more fully utilize the user's graphics hardware.
- Generics — An enhancement to the type system that supports operations on objects of various types while providing compile-time type safety. Note that this lesson is for advanced users. The Java Language trail contains a Generics lesson that is suitable for beginners.
- Internationalization — An introduction to designing software so that it can be easily be adapted (localized) to various languages and regions.
- JavaBeans — The Java platform's component technology.
- JDBC Database Access — Introduces an API for connectivity between the Java applications and a wide range of databases and a data sources.
- JMX— Java Management Extensions provides a standard way of managing resources such as applications, devices, and services.
- JNDI— Java Naming and Directory Interface enables accessing the Naming and Directory Service such as DNS and LDAP.
- JAXP — Introduces the Java API for XML Processing (JAXP) 1.4 technology.
- JAXB — Introduces the Java architecture for XML Binding (JAXB) technology.
- RMI — The Remote Method Invocation API allows an object to invoke methods of an object running on another Java Virtual Machine.
- Reflection — An API that represents ("reflects") the classes, interfaces, and objects in the current Java Virtual Machine.
- Security — Java platform features that help protect applications from malicious software.
- Sound — An API for playing sound data from applications.
- 2D Graphics — How to display and print 2D graphics in applications.
- Sockets Direct Protocol — How to enable the Sockets Direct Protocol to take advantage of InfiniBand.
Your use of this page http://docs.oracle.com/javase/tutorial and all the material on pages under "The Java Tutorials" banner is subject to the Terms of Use. Additionally, any example code contained in any of these Java Tutorials pages is also licensed under the Code Sample License.