0% found this document useful (0 votes)
17 views15 pages

File1-Unit-1 (Java Intro) - 1

Uploaded by

Ayush Kotnala
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
17 views15 pages

File1-Unit-1 (Java Intro) - 1

Uploaded by

Ayush Kotnala
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 15

UNIT-1

Introduction to Java
What is Java?
• Java is one of the most popular and widely used programming
language and platform.
• A platform is an environment that helps to develop and run
programs written in any programming language.
• Java is a high level, robust, object-oriented and secure
programming language.
• Java was developed by Sun Microsystems (which is now the
subsidiary of Oracle) in the year 1995. James Gosling is known as
the father of Java. Before Java, its name was OAK. Since OAK was
already a registered company, so James Gosling and his team
changed the name from Oak to Java.
Applications
There are many devices where Java is currently used. Some of them are as
follows:
• Desktop Applications such as acrobat reader, media player, antivirus, etc.
• Web Applications such as irctc.co.in, javatpoint.com, etc.
• Enterprise Applications such as banking applications.
• Mobile
• Embedded System
• Smart Card
• Robotics
• Games, etc.
Types of Java Applications
There are mainly 4 types of applications that can be created using Java
programming:
1) Standalone Application
Standalone applications are also known as desktop applications or
window-based applications. These are traditional software that we
need to install on every machine. Examples of standalone application
are Media player, antivirus, etc. AWT and Swing are used in Java for
creating standalone applications.
2) Web Application
An application that runs on the server side and creates a dynamic page
is called a web application. Currently, Servlet, JSP, etc. technologies are
used for creating web applications in Java.
Contd…
3) Enterprise Application
An application that is distributed in nature, such as banking
applications, etc. is called an enterprise application. It has advantages
like high-level security, load balancing, and clustering.
4) Mobile Application
An application which is created for mobile devices is called a mobile
application. Currently, Android and Java ME are used for creating
mobile applications.
Java Terminology
1. Java Virtual Machine(JVM): This is generally referred to as JVM. There
are three execution phases of a program. They are written, compile and
run the program.
• The compilation is done by the JAVAC compiler which is a primary Java
compiler included in the Java development kit (JDK). It takes the Java
program as input and generates bytecode as output.
• In the Running phase of a program, JVM executes the bytecode
generated by the compiler.
The function of Java Virtual Machine is to execute the bytecode produced
by the compiler. Every Operating System has a different JVM but the
output they produce after the execution of bytecode is the same across
all the operating systems. This is why Java is known as a platform-
independent language.
• 2. Bytecode in the Development process: Javac compiler of JDK
compiles the java source code into bytecode so that it can be executed
by JVM. It is saved as .class file by the compiler.
• 3. Java Development Kit(JDK): While we were using the term JDK when
we learn about bytecode and JVM. So, as the name suggests, it is a
complete Java development kit that includes everything including
compiler, Java Runtime Environment (JRE), java debuggers, java docs,
etc. For the program to execute in java, we need to install JDK on our
computer in order to create, compile and run the java program.
• 4. Java Runtime Environment (JRE): JDK includes JRE. JRE installation
on our computers allows the java program to run, however, we cannot
compile it.
JRE includes a browser, JVM, applet supports, and plugins. For running
the java program, a computer needs JRE.
• 5. Garbage Collector: In Java, programmers can’t delete the
objects. To delete or recollect that memory JVM has a program
called Garbage Collector. Garbage Collectors can recollect the
objects that are not referenced. So Java makes the life of a
programmer easy by handling memory management.
• 6. ClassPath: The classpath is the file path where the java
runtime and Java compiler look for .class files to load. By
default, JDK provides many libraries. To include external
libraries they should be added to the classpath.
Features of Java
• Simple
• Object-Oriented
• Portable
• Platform independent
• Secured
• Robust
• Architecture neutral
• Interpreted
• High Performance
• Multithreaded
• Distributed
• Dynamic
• 1. Platform Independent: Compiler converts source code to bytecode and
then the JVM executes the bytecode generated by the compiler. This bytecode
can run on any platform be it Windows, Linux, or macOS which means if we
compile a program on Windows, then we can run it on Linux and vice versa.
Each operating system has a different JVM, but the output produced by all the
OS is the same after the execution of bytecode. That is why we call java a
platform-independent language.
• 2. Object-Oriented Programming Language: Organizing the program in the
terms of collection of objects is a way of object-oriented programming, each
of which represents an instance of the class.
• The four main concepts of Object-Oriented programming are:
• Abstraction
• Encapsulation
• Inheritance
• Polymorphism
• 3. Simple: Java is one of the simple languages as it does not have complex
features like pointers, operator overloading, multiple inheritances, and
Explicit memory allocation.
• 4. Robust: Java language is robust which means reliable. It is
developed in such a way that it puts a lot of effort into checking
errors as early as possible, that is why the java compiler is able to
detect even those errors that are not easy to detect by another
programming language. The main features of java that make it robust
are garbage collection, Exception Handling, and memory allocation.
• 5. Secure: In java, we don’t have pointers, so we cannot access out-
of-bound arrays i.e it shows ArrayIndexOutOfBound Exception if we
try to do so. That’s why several security flaws like stack corruption or
buffer overflow are impossible to exploit in Java. Also java programs
run in an environment that is independent of the os(operating
system) environment which makes java programs more secure .
• 6. Distributed: We can create distributed applications using the java
programming language. Remote Method Invocation and Enterprise
Java Beans are used for creating distributed applications in java. The
java programs can be easily distributed on one or more systems that
are connected to each other through an internet connection.
• 7. Multithreading: Java supports multithreading. It is a Java feature
that allows concurrent execution of two or more parts of a program
for maximum utilization of the CPU.
• 8. Portable: As we know, java code written on one machine can be
run on another machine. The platform-independent feature of java in
which its platform-independent bytecode can be taken to any
platform for execution makes java portable.
• 9. High Performance: Java architecture is defined in such a
way that it reduces overhead during the runtime and at some
time java uses Just In Time (JIT) compiler where the compiler
compiles code on-demand basics where it only compiles those
methods that are called making applications to execute faster.
• 10. Dynamic flexibility: Java being completely object-oriented
gives us the flexibility to add classes, new methods to existing
classes and even create new classes through sub-classes. Java
even supports functions written in other languages such as C,
C++ which are referred to as native methods.
• 12. Write Once Run Anywhere: As discussed above java application
generates a ‘.class’ file which corresponds to our
applications(program) but contains code in binary format. It provides
ease t architecture-neutral ease as bytecode is not dependent on any
machine architecture. It is the primary reason java is used in the
enterprising IT industry globally worldwide.
• 13. Power of compilation and interpretation: Most languages are
designed with purpose either they are compiled language or they are
interpreted language. But java integrates arising enormous power as
Java compiler compiles the source code to bytecode and
JVM executes this bytecode to machine OS-dependent executable
code.

You might also like