0% found this document useful (0 votes)
21 views7 pages

Day 8

1. The document discusses Java programming concepts including what Java is, who invented it, and why it achieves platform independence. 2. Java achieves platform independence by compiling code into bytecode that runs on a Java Virtual Machine (JVM) instead of directly on hardware. The JVM then converts the bytecode into machine code for the operating system. 3. The development process for Java programs involves writing source code files with a .java extension, compiling them with javac to generate .class files of bytecode, and then running the program with a JVM.

Uploaded by

John rockfiller
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views7 pages

Day 8

1. The document discusses Java programming concepts including what Java is, who invented it, and why it achieves platform independence. 2. Java achieves platform independence by compiling code into bytecode that runs on a Java Virtual Machine (JVM) instead of directly on hardware. The JVM then converts the bytecode into machine code for the operating system. 3. The development process for Java programs involves writing source code files with a .java extension, compiling them with javac to generate .class files of bytecode, and then running the program with a JVM.

Uploaded by

John rockfiller
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

Chapter #1: Introduction to Java

1. What is Java?
2. Who invented Java?
3. Why Java?
4. Platform, Platform Dependency(PD), Platform Independency(PI)?
5. Two types of applications?
6. Java concepts to develop Stand-alone(SA) and Internet Application(IA)?

7. Different terminologies used in every PL?


8. What is P, PD, PI and Why C and C++ PLs are PD?
9. How Java achieved PI?
10. Java program development, compilation and execution procedure?
11. Import facts on Java program and Java software?
12. Types of Java SWs, Java 9v and 11v changes?

11. Java versions, LTS, non-LTS, Stable and Latest version?


12. Downloading and installing JDK
13. Setting JAVA_HOME, path and classpath enviroment variables

14. Softwares required to develop a Java program?


15. Essential Statements to develop a Java program?
14. Steps to develop Java program?
15. Hello, World! application development, compilation and execution
16. Solving CEs and REs by your own
17. Compiler and JVM activites in compiling and executing Java program

1. What is Java?
- Java is a Platform Independent
Object-Oriented Programming Language.

2. Who invented Java?


- Java is inveted by Mr. James Gosling
in Sun Microsystems in the year 1991

3. Why Java is invented?


- Java is invented for achieving Platform Independency
for supporting internet applications development.

4. What is a platform?
- A platform is an environment in which
a program is loaded and executed.

- A platform can be a software only platform


or hardware only platform of both.

- A computer platform is both SW and HW platform


it is [OS + Hardware Devices]

- C and C++ programs' platform is


software only platform that is OS

- Java programs platform is JVM (Java Virtual Machine)


- Python programs platform is PVM (Python Virtual Machine)
- HTML pages platfrom is Browser
- mp3 and mp4 files platform is VLC (Media Player Software)

5. What is platfrom dependency?


- A program that is developed and compiled in OS
if it is not executed in different OS, we call it
as platform dependent program. The programming language
that is used for developing this program is called
platform dependent programming language.

For example: C and C++

6. What is platfrom independency?


- A program that is developed and compiled in OS
if it is executed in different OS, we call it
as platform independent program. The programming language
that is used for developing this program is called
platform independent programming language.

For example: Java, Python, .Net, ...

7. Types of applications
- All softwares are divided into two types
1. Stand-alone applications (SA)
2. Internet applications (IA)

- An application that can not be accessed from other computers


via internet with network call stand-alone application. It means
an application that can be accessed only within one computer with
local call in which it is installed is called stand-alone application.

- A SA is a single computer and single user application. It means


at a time only one user can use/run this application.

For example: Calc, Notepad, Paint, PPT, Browser, Mobile app

- An application that can accessed via internet with a network call


is called internet application. An internet application can also
be accessed with in the same computer in which it is installed.

- An IA is a multi computer and multi user application. It means


at time it can be accessed and executed by multiple users.

For example: hdfcbank.com, flipkart.com, irctc.com, nareshit.com, ...

8. Java concepts to develop SA and IA?


- For developing SA just Core Java concepts are sufficient.
- For developing IA along with Core Java concepts, we must also
use Adv Java or Spring Boot concepts.

- By using Core Java concepts we can develop one complete project.


But this project cann't be accessed from other computer through network.
- Core Java develops project, ADV Java and Spring Boot, makes this project
internet accessible and DB accessible.

9. Why C and C++ programs are PD?


- The C and C++ programs are compiled targetting to one OS.
- Hence the C and C++ programs compiled code contains direct
machine language of current OS whose format is not understandable
to other OS, hence it cann't be executed by other OS, hence
C and C++ programs are PD.

Windows OS
Source code Compiled code
Addition.c Compiler Addition.exe windows -> exe -> OP
(M/C=0s and 1s)

Linux OS
Addition.exe Linux -> !exe

Mac OS
Addition.exe Mac -> !exe

10. How Java achieved PI?

Windows OS
Addition.java

Java
Compiler

Addition.class
(Byte code=Small commands)

Windows OS Linux Os Mac OS

Addition.class Addition.class Addition.class

Windows Linux Mac


JVM JVM JVM

Converts Converts Converts


B/C to M/C B/C to M/C B/C to M/C
of Windows of Linux of Mac

Windows OS Linux OS Mac OS


Exe MC Exe MC Exe MC

generates generates generates


O/P O/P O/P

- In Java, program is not compiled targetting to any particular OS.


- In Java, program is compiled into an intermediate code called bytecode
which common to all OSs.
- To convet this byte code into a particaly OS MC, we have a translation SW
called JVM.

- For achieving PI, in Java the MC generation is moved


from compilation phase to execution phase by introducing
1. new compiler software
2. byte code
3. JVM

- This new compiler software convets source code into bytecode


- The byte code the set of instruction to the JVM to run Java program.
Byte code is not MC or not native code to an OS or processor, it
is the native code of JVM.
- JVM is the Java platform, it is responsible for running Java byte code
by converting it into current OS MC.
- We have sepearte JVM for each OS for the running the same compiled
in all OS, hence Java program is PI.

Summary
- If any PL program contains MC and if it is executed directly by OS,
it is always PD.

- If any PL program does not contain MC, not directly executed by OS,
if it is executed by one intermediate software, that program is always
PI.

11. Java program development, compilation and execution procedure?


- In the Java programming language, all source code is first written
in plain text files ending with the��.java��extension.
- Those source files are then compiled into��.class��files by the javac
compiler.
- A��.class��file does not contain code that is native to your
processor;
it instead contains bytecodes�� the native language of
the Java Virtual Machine.
- The�java launcher tool then runs your application with an instance
of the Java Virtual Machine.

12. Important facts on Java program and Java software?


1. Java Slogan: WORA- Write Once Run Anywhere
2. Compiler is responsible to take Java source code, convert it into bytecode
and saving this bytecode in a separate new file with ".class� extension with class
name as file name.
3. JVM is responsible to take Java bytecode, execute this bytecode by
converting it into current OS ML. After execution generated ML is destroyed.
4. Java supports only 2 extension files .java and .class
5. In Java we do not have a exe file with machine language code, means Java
does not support .exe file, because it is platform dependent, it is not safe,
easily effected by virus, and more over always compiled code is downloaded from
server, hence ML code saved in client system is useless.
6. Java compiler is OS independent because both input and output files source
code and bytecode are Java related files.
7. JVM is OS dependent, because it should generate OS dependent ML from the
given bytecode.
8. Java software contains
Compiler --------> PI
+
JVM --------> PD
+
API --------> PI
------
PD
------
9. Java software is platform dependent because JVM is platform dependent.
Because Java Software is platform dependent, we will have separate Java software
for every OS. Hence based on our system OS and processor we must download and
install Java software
10. Java program is platform independent and Java software is platform
dependent, both because of JVM.
- Java program platform independent, because JVM is available for every
OS, so Java program can be executed in all OS
- Java software is platform dependent, because we have separate JVM for
every OS, so the same Java software can not be installed on all OS.
11. For all OS, JVM is developed by SUN(Oracle), but not by OS Vendors. So,
JVM will not be installed inbuilt along with OS installation. We must install JVM
explicitly in our computer after OS installation.
13. Programmer is responsible for developing, compiling and executing a
Java program, Whereas
14. Customer /Client is responsible for only executing Java program.
15. Based on programmer and customer responsibilities Java software is
divided into two types

13. Types of Java Softwares


- Java software is divided into two types
1. JDK [Compiler + JVM + API]
2. JRE [JVM + API]

- JDK stands for Java Development Kit.


- It provides Development tools and Runtime environment
- Hence JDK contians Compiler + JVM + API
- Then By using JDK we can develop new applications and also
we can moidify existing applications.

- JRE stands for Java Runtime Environment.


- It provides only Runtime environment
- Hence JRE contians only JVM and API
- Then by using JRE we can only run already developed applications.

- Hence
- In Developer system we must install JDK
- In Testers and customers system we must install JRE

- API stands for Application Programming Interface


- it contains predefined programs given by SUN or other developers

- By using API we will develop our programs


- By using Compiler we will compile our programs
- By using JVM we will execute our programs

14. Java Versions history, LTS, non-LTS, stable and latest version
1. A version is a unique number (it can be alpha numberic number)
using which a product new features are identified.

2. Like other softwares Java is also has diff version numbers


starts with Java 1.0

==============================================================================
Java Software Principle Products Editions
==============================================================================
Java 1.0 jdk 1.0 jre 1.0
Java 1.1 jdk 1.1 jre 1.1

Java 2 Platform 1.2 j2sdk 1.2 j2sre 1.2 J2SE, J2EE, J2ME
Java 2 Platform 1.3 j2sdk 1.3 j2sre 1.3 J2SE, J2EE, J2ME
Java 2 Platform 1.4 j2sdk 1.4 j2sre 1.4 J2SE, J2EE, J2ME

Java Platform 5.0 jdk 1.5 jre 1.5 Java SE, Java EE, Java ME
Java Platform 6 jdk 1.6 jre 1.6 Java SE, Java EE, Java ME,
Java FX
Java Platform 7 jdk 1.7 jre 1.7 Java SE, Java EE, Java ME,
Java FX
Java Platform 8(LTS) jdk 1.8 jre 1.8 Java SE, Java EE, Java ME,
Java FX

Java Platform 9 jdk-9 jre-9 Java SE, Java EE, Java ME, Java FX
Java Platform 10 jdk-10 jre-10 Java SE, Java EE, Java ME, Java FX

Java Platform 11(LTS) jdk-11 Java SE, Java EE, Java ME,
Java FX
.....
Java Platform 17(LTS) jdk-17 Java SE, Java EE, Java ME,
Java FX
.....
Java Platform 20 jdk-20 Java SE, Java EE, Java ME, Java FX
Java Platform 21(LTS) jdk-21 Java SE, Java EE, Java ME,
Java FX

===================================================================================
======

Latest names of the editions


1. Java SE [Java platform Standard Edition]
2. Jakarta EE [Jakarta Enterprise Edition]
3. Java ME [Java Platform Micro Edition] [Alt -> Android]
4. Java FX [Java Eff'ects] [Alt -> HTML, CSS, JS]

===================================================================================
======
Among all these editions we are here to learn to only
1. Java SE - for developing stand-alone appliations
2. Java EE - for developing Web and enterprise appliations

In CJ - we will learn Java SE


In AJ - we will learn Java EE

when we install JDK we will get only Java SE concepts


and we can develop only stand-alone appliations

For get Java EE concepts and for developing web and enterpise applications
in addition to JDK we must also install "Web Server Software" [tomcat]

===================================================================================
======
16. Why we dont install JRE is in our computers when we access any Java
website(ex:amazon)?
- because the UI componets are developed by using HTML, CSS, JS
- for running HTML pages, JRE is not required, just browser is enough

15. Why public JRE is removed in Java 11v, why is it not required?
- because UI components are developed by using HTML
- Java is not used to developing UI components
- Hence a separate JRE is useless, hence it is removed
from Java 11v onwards.

===================================================================================
======

16. What is Long Term Support(LTS) version and non-LTS version?


- When a new versin is relased the previous version is also availble for
download
then that version is called LTS version, if not available it is called non-
LTS
version.

- Java 8, 11, 17, 21 versions are LTS versions.

- For develop projects we must use stable LTS version


- The stable version means there are no bugs(problem) in the software
we can use it for developing projects.

- In companies we are use Java 8v


slowing companies are moving to 11v and 17v
===================================================================================
======
17. Dowloading and Installing JDK-21
- For developing, compiling and executing a Java applications
we need a Java software called JDK (Java Development Kit)

- Download and install Oracle-JDK from Oracle web site as below


1. Open browser
2. Serach "jdk latest version download"
3. Click "Java Downloads"
4. Click "Windows"
5. Click "jdk-21.exe" file link
6. Downloading will be started

7. After downloading, clicl on jdk.exe file


8. JDK installation will be started
9. Click "Yes" -> "Next"
10. Then click "Change"
11. Modify JDK installation path as "C:\jdk-21"
12. Click "Ok" -> Next -> Close

- JDK installation is completed in the folder "C:\jdk-20"


18. Running JDK software
1. open cmd prompt software [Press start key -> type cmd -> press enter key]
2. type and run the below command
cmd>java -version
3. You see Java version number and released date
means Java software is successfully intalled and running

You might also like