0% found this document useful (0 votes)
4 views

JAVA DAY 1

Uploaded by

selene6141744
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

JAVA DAY 1

Uploaded by

selene6141744
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

JAVA DAY 1

1. Introduction

What is Java?
Java is a popular programming language, created in 1995.
It is owned by Oracle, and more than 3 billion devices run Java.
It is used for:
● Mobile applications (especially Android apps)
● Desktop applications
● Web applications
● Smart Card
● Robotics
● Games

Types of Java Applications


There are mainly 4 types of applications that can be created using
Java programming:

1.Standalone Application
It is also known as desktop application or window-based applications.
These are traditional software that are needed to install on every
machine.
E.g.: Media player, word etc.

2.Web Application
An application that runs on the server side and creates a dynamic page
is called web applications. Currently Servlet, JSP, Spring, hibernate
etc. technologies are used for creating web applications in java.
3.Enterprise Application
An application that is distributed in nature, Such as a banking
application. It has advantages of 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 Platforms / Editions


● Java SE (Java Standard Edition)
● Java EE (Java Enterprise Edition)
● Java ME (Java Micro Edition)
● JavaFX

Why Use Java?


● Java works on different platforms (Windows, Mac, Linux,
Raspberry Pi, etc.)
● It is one of the most popular programming language in the world
● It is easy to learn and simple to use
● It is open-source and free
● It is secure, fast and powerful
● Java is an object oriented language which gives a clear structure
to programs and allows code to be reused.
● Reduce the development costs.
● As Java is close to languages like C++ and C#

2. History of Java

● The history of Java is very interesting. Java was originally


designed for interactive television, but it was too advanced
technology for the digital cable television industry at the time.
● James Gosling, Mike Sheridan, and Patrick
Naughton initiated the Java language project in June 1991. The
small team of sun engineers called Green Team.
Father of JAVA: James Gosling

● Firstly, it was called "Greentalk" by James Gosling, and the


file extension was .gt.
● After that, it was called Oak and was developed as a part of the
Green project.
● Oak is a symbol of strength and chosen as a national tree of
many countries like the U.S.A., France, Germany, Romania, etc.

● In 1995, Oak was renamed as "Java" because it was already a


trademark by Oak Technologies.
● Java is an island in Indonesia where the first coffee was
produced (called Java coffee). It is a kind of espresso bean. Java
name was chosen by James Gosling while having a cup of
coffee nearby his office.

3. Features of Java

Features of java is also known as Java buzzwords

1)Simple

● Java syntax is based on C++ (so it is easier for programmers


to learn it after C++).
● Java has removed many complicated and rarely-used features,
for example, explicit pointers, operator overloading, etc.
● There is no need to remove unreferenced objects because
there is an Automatic Garbage Collection in Java.

2)Object-oriented

● Java is an object-oriented programming language. Everything


in Java is an object. Object-oriented means we organise our
software as a combination of different types of objects that
incorporate both data and behaviour.

3)Platform Independent

● Java is a write once, run anywhere language(WORA).

4)Secured

● Java is best known for its security. With Java, we can develop
virus-free systems.
● Java programs run on JRE(Java Runtime Environment) and
have no interaction with our system OS.
5)Robust

Meaning of Robust is strong.


Java is robust because:
● Strong memory management.
● Lack of pointers that avoids security problems.
● Java provides automatic garbage collection which runs on the
Java Virtual Machine to get rid of objects which are not being
used by a Java application anymore.
● Exception handling and the type checking mechanism in Java.

6)Architecture-neutral

● Java is architecture neutral because there are no implementation


dependent features, for example, the size of primitive types is
fixed.

7)Portable

● Java is portable because it facilitates you to carry the Java byte


code to any platform. It doesn't require any implementation.
8)High-performance

● Java is faster than other traditional interpreted programming


languages because Java byte code is "close" to native code. It is
still a little bit slower than a compiled language (e.g., C++).
● Java is an interpreted language that is why it is slower than
compiled languages, e.g., C, C++, etc.

9)Distributed

● Java is distributed because it facilitates users to create


distributed applications in Java.
● RMI and EJB are used for creating distributed applications.
Compared to other languages it is easy to create network
connections in Java.

10)Multi-threaded

● A thread is like a separate program, executing concurrently.


● Write Java programs that deal with many tasks at once by
defining multiple threads.
● The main advantage of multi-threading is that it doesn't occupy
memory for each thread. It shares a common memory area.
● Threads are important for multimedia, Web applications, etc.

11)Dynamic

● Java is a dynamic language.


● It supports the dynamic loading of classes.
● It means classes are loaded on demand.
12)Interpreted
● An Interpreter in Java is a computer program that helps to
convert a high-level program statement into a machine
code.
● It comprises source code, pre-compiled code, and scripts.
● An Interpreter converts the code into machine code when
the program is run.

4. JVM JRE and JDK

Source File

Source file is used for saving the java source code which must be
saved with .java extension and the compiler will converts it into byte
code which will be its .class extension file

File name: Hello.java


public class Hello
{
public static void main(String[] args)
{
System.out.print("My first program in java");
}
}

Internal working during compile time

● When you compile the Hello.java file then the compiler creates
a .class file
● .class file is created with the name Hello.class
● Hello.class contains byte codes
Byte code (.class file) is specialised set of instruction that JVM can
read. Thus this .class file consisting of byte code can be transported to
another system, irrespective of the operating system it has, and could
be executed comfortably without any issue.
● This is why java a portable language.
● Because of the same reason java is also popularly known
as Write once, run anywhere (WORA) language.

JVM is capable of reading, verifying the bytecode.

Internal working during run time


During run or execution time following tasks are performed within
JVM:
● Class loader loads the .class files containing bytecode to the
memory.
● Next the bytecode is verified and checked for any errors or bugs
which may result in the program exhibiting anomalous behavior.
● At last, the just-in-time compiler converts the bytecode into
machine code.
Compile + Run diagram of java code

Java Virtual Machine - JVM

JVM is a virtual machine which is capable of reading the .class


file that contains bytecode.
In java, the compiler produces bytecode during compilation which
can be run on any system that has JVM installed on it. This results in
making java a portable programming language. It can be written on
any system and run-on different systems easily irrespective of the
operating system. Thus, java is also referred to as write once, run
anywhere.

JVM performs three major tasks:


● Loads code
● Verifies code
● Executes code
● Provides runtime environment

Java Runtime Environment - JRE

● JRE provides an environment to run java applications.


● JRE contains supporting libraries, core classes and other
components that JVM uses during the runtime.
● JRE is part of JDK. It can also be downloaded separately to just
run java applications and applets.

Java Development Kit – JDK


JDK comprises JRE and other tools that help in developing,
debugging & monitoring the java application.
A JDK always comprises of:
● JRE
● Compiler (javac)
● Debugger
● Java document

5. IDE

● Java IDE (Integrated Development Environment) is a software


application that enables users to write and debug Java programs
more easily.
● Most IDEs have features such as syntax highlighting and code
completion that helps users to code more easily.
● Usually, Java IDEs include a code editor, a compiler, a
debugger, and an interpreter that the developer may access via a
single graphical user interface.
● Java IDEs also provide language-specific elements such as
Maven, Ant building tools, Junit, and TestNG for testing.
● The Java IDE or Integrated Development Environment provides
considerable support for the application development process.
● Through using them, we can save time and effort and set up a
standard development process for the team or company.
● Eclipse, NetBeans,IntelliJ IDEA, and many other IDE's are the
most popular Java IDE's that can be used according to our
requirements.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy