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
Package in Java programming language is like folder which puts together group of classes, interfaces and sub-packages.
The main usage of packages are:
Avoid conflicts in naming. For instance, there can be more than one classes with name Employee in two packages, college.staff.cse.Employee and university.staff.ee.Employee
Searching/Locating and usage of classes, interfaces, enumerations and annotations easier
Control the access: protected and default have package level access control which means that protected member is accessible by classes in the same package and its subclasses. A member without any access specifier (also known as default) is accessible by classes in the same package only.
Packages can be considered as a tool for data encapsulation
Our responsibility is to put logically connected classes in the same package which in future will help us to find any specific class. Names of packages and general structure of directory are closely related to each other. For example if a package name is department.staff.developers, then there are three directories, department, staff and developers such that developers is present in staff and staff is present department.
Package has following convention of naming: They are named in reverse order of domain names. For example, in a department, the recommended convention is department.staff.developers, department.staff.testers, department.staff.analysts, etc.
Each Java class must belong to a package. We can explicitly name the package by defining a package statement in the beginning of the java file. If the package statement is skipped, the class belongs to the default package, with no sub-directory structure.
Use of default package is not recommended unless we don’t write toy program or our intention is not quick testing.
Don't miss out!