Introduction To Java
Introduction To Java
Introduction To Java
Why Java?
● Runs on more than 5.5 billion devices. Java is versatile and applicable to Web
Development, Mobile Apps (Android), Desktop Applications, IOT Devices and more.
● Java's OOP implementation is widely regarded as robust and effective.
● Enterprise and Large-Scale Systems. Java is trusted for its stability, scalability, and
security in mission-critical projects.
● Platform Independency allows Java to compile it’s code once and run in any OS with
a JVM (Java Virtual Machine).
Platform Independency - A key feature of Java
In order to understand Platform Independency, we must know about three core
components of Java and understand how Java executes its codes.
● JVM (Java Virtual Machine) is platform dependent interpreter. This is the component that
executes bytecode. Mac, Linux, Windows each has different JVMs.
● JRE (Java Runtime Environment) contains the environment and libraries that JVM uses to
execute Java programs. JRE includes JVM as well. JRE is required to RUN any java program.
● JDK (Java Development Kit) contains various tools for developers like Java Compiler (javac)
, Java Debugger (jdb) etc. JDK is required for coding and developing Java applications. JRE is
included with JDK.
Platform Independency (Contd.)
1) Java code goes through the compiler within the JDK.
2) Compiler converts Java Code to Byte Code which is platform independent. Now this
ByteCode can be run in any OS without compiling.
3) This ByteCode (.class file) is executed by the JVM using various libraries from the JRE.
Byte Code
Source Files (.class) files
(.java) files Compiler JVM Libraries
JDK JRE
Debugger
Installing JDK & DrJava
For this course we’ll be using JDK version 8.
Link to DrJava:
https://drive.google.com/file/d/1bNB0VWxQPOJ1SFmA9nFwHt_TRhm3JvVu/view
Writing Your First Program
Let’s write our first program using Java
1. public : An access modifier keyword. It means the class/method is accessible from any
other classes. Private and Protected are other types of access modifiers.
2. class : keyword is used to specify the classname. In our example, class FirstProgram
means that FirstProgram is the classname.
Note: We’ll learn more about scopes in the Branching and Loop chapters.
THANK YOU!