i
Understanding Requirement: Why Java
Why Java is important to the Internet
Java On Linux
First Java Program
Java Virtual Machine Architecture
Class Loading Process by Class Loaders
Role Of Just In Time Compiler
Execution Engine
Data Types
Variables
Arrays
Operators
Arithmetic Operations
Shifting Operators
Logical Operators
Control Statements
Object Oriented Paradigms
The Three OOP principles
Looping Statements
JAVA Class Fundamentals
Command Line Arguments
Static Initialize
Creating an Object
Instance Variable Hiding
Overriding and Overloading of methods
Understanding The Access Controls
Nested And Inner Classes
Dynamic Method Dispatching
Abstract Classes
Using Final To Prevent Overriding & Inheritance
Garbage Collection
Defining a package
Understanding Classpath
Access Protection
Importing packages
Defining and Implementing An Interface
Abstract classes vs Interfaces
Generics
Annotations
Varargs
Foreach
Fundamentals Of Exception Handling
Types Of Exceptions
Learning exception handling, try-catch, multiple catch clauses
Nested Try Statements
Throw, Throws and Finally
Custom Exceptions
Java Thread Model
Creating A Thread
Context Switching
Synchronization: Methods And Statements
Inter-thread Communication
We have already spoken about Files and some operations of files. Methods read() and write() have also another signature, which gets array of byte as a parameter. This kind of operations are faster. Generally working on bytes are faster. BufferedInputStream and BufferedOutputStream are more effective by buffering the input stream and output stream as they reduce the number of calls to the native API.
The code example below use the FileInputStream and FileOutputStream classes to perform low level binary I/O operations. This code copies one file to another, one byte at a time.
Let’s revisit the exceptions handling. In this example we see try has in parentheses InputStream and OutputStream creation. This is try with resources. Generally, while working with files, we need to close all resources after finishing work on them, but try with resources (this example) which is introduced in Java 7, helps us to deal with this automatically and take away care about resources from us.
Don't miss out!