Unit 1: Introduction To Java (2 HRS)
Unit 1: Introduction To Java (2 HRS)
Unit 1: Introduction To Java (2 HRS)
●
Definition and History of Java
●
The internet and Java’s Place in IT
●
Applications and Applets
●
Java Virtual Machine (JVM)
●
Byte code – not an executable code
●
Procedure – oriented vs. object – oriented
programming
●
Compiling and Running a simple program
●
Setting up your computer for Java Environment
Writing a program
●
Compiling, Interpreting and Running the
program
●
Handling common Errors
●
Conceived by James Gosling, Patrick Noughton,
Christ Warth, Ed Frank and Mike Sheridan at
Sun Microsystem Inc. in 1991.
●
Initially called “Oak” but late renamed as Java
in 1995.
●
Related to C++, which is the direct descendant
of C.
●
Much characters are inherited from both two
language i.e., C and C++.
●
Syntax, derived from C and object oriented
concept from C++.
●
Since, a language is designed to solve the
fundamental problem of the preceding
language could not solve, Java is no exception.
Your task.
Features of Java
Simple
Platform independent
Secure and portable
Object-oriented
Robust
Multi-threaded
Features of Java
Architectural Neutral
Compiled and interpreted
Distributed
Dynamic
Simple
Designed to be easy to learn and effective to use.
Comparing with other languages, not difficult to master and
provides a small number of clearly defined ways to
accomplish a given task.
User familiar with C and C++, finds easy to master Java, since
it is inherits the syntax of C and C++ and object oriented
features of C++.
Object-oriented
Not designed to be source code compatible with any other
language.
“Everything is an object” paradigm.
Object model in java is simple and easy to extend.
Robust
Ability to create robust program.
Strictly or strong typed language and restricts the
programmer in few key areas.
Checks the program code at compile time as well as at run
time.
Unlike C/C++, manages memory allocation and deallocation
on its own.
Deallocation of memory is automatic, also provide object
oriented exception handling.
Multi-threaded
Designed to meet the real world requirement of creating
interactive networked programs.
Supports multi-threading, that allows us to write program the
can do many this simultaneously.
Architecture Neutral
Upgrading of OS, processor upgrades and changes in the core
system resources can be the factor that causes malfunction of
program that was running successfully at a later point of time.
Java and JVM has been designed in such a way so as to
attempt to overcome this situation, which would enable the
programs to run in-spite of environmental changes.
Distributed
Java handles TCP/IP protocols.
Accessing a resources using URL is similar to accessing a file.
Has a package called Remote Method Invocation (RMI), which
brings a very high level of abstraction to client/server
programming.
Dynamic
Programs have the capability to carry sufficient amount of run
time type information.
The information can be use to verify and resolve accesses to
the object at run time.
●
Also called procedure oriented programming.
●
Program in this approach is a list of
instructions that follows step-by-step
approach.
●
Each instruction tells the computer to do
something.
●
Instruction can be like
●
Get some input
●
Add these number
●
Divide by seven
●
Display the output
32 Prepared by: Shiva Bhat
tarai
Procedural Programming
Class
A blueprint of an object which defines all the common
properties of objects.
A class is used to define multiple object within a program.
Object
a self-contained entity that consists of data and functions, and
functions is used to access the data within the object.
Object is an instance of a class.
Borland Jbuilder
NetBeans, Open source by Sun (oracle)
Eclipse, Open source by IBM
Oracle JDeveloper
●
To compile
javac HelloWorld.java
●
To run
java HelloWorld
●
To compile
javac UseArgument.java
●
To run
java UseArgument shiva