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 touched shortly how to initialize and declare objects from classes in Java. There are few ways of objects declaration
One of them is declaration/initialization object with constructor and new keyword.
This example declares class City with two properties: name and population. Also City class has only one constructor (with two arguments). In constructor we are initializing class variables with passed values. In main method, we are creating new object and variable name is newYork. Before actual City class constructor is called, name and population properties were holding default values: name = null and population = 0.
Let’s review a bit advanced way of creation actual instance of class. It is done with newInstance() method call which is actual method of Class (this is not the class you created, it is from Java). If we know the name of the class & if it has a public default constructor we can create an object –Class.forName. We can use it to create the Object of a Class. Class.forName actually loads the Class in Java but doesn’t create any Object. To Create an Object of the Class you have to use the new Instance Method of the Class.
This is a bit advanced topic but here it is for only example sake. In practice it is very, very rarely used.
Don't miss out!