Introduction to Java
Levent YILDIZ
levent.yildiz@bilgeadam.com
2
What is Java ?
A general-purpose object-oriented
language.
-Java is simple
-Java is object-oriented
-Java is distributed
-Java is interpreted
-Java is secure
-Java is portable
-Java’s performance
-Java is multithreaded
-Java is dynamic
3
Birth and Growth of Java
- James Gosling and Sun
Microsystems
- Oak
- Green
- Java, May 20, 1995, Sun World
- WORA(Write once, run
anywhere)
4
JDK Editions
- Java Standard Edition (J2SE)
J2SE can be used to develop client-side standalone applications or
applets.
- Java Enterprise Edition (J2EE)
J2EE can be used to develop server-side applications such as Java
servlets and Java ServerPages.
- Java Micro Edition (J2ME).
J2ME can be used to develop applications for mobile devices such
as cell phones.
5
History
Java Evolutions
- JDK Beta (1995)
- JDK 1.0 (January 1996)
- JDK 1.1 (February 1997)
- J2SE 1.2 (December 1998)
- J2SE 1.3 (May 2000)
- J2SE 1.4 (February 2002)
- J2SE 5.0 (September 2004)
- Java SE 6 (December 2006)
- Java SE 7 (July 2011)
- Java SE 8 (March 2014)
- Java SE 9 (September 2017)
- Java SE 10 (March 2018)
- Java SE 11 (September 2018)
- Java SE 12 (March 2019)
- Java SE 13 (September 2019)
- Java SE 14 (March 2020)
6
An Important Note
Java and Javascript
are similar like Car and
Carpet are similar.
In Summary Java is
not Javascript
7
JDK, JRE, JVM
JDK is a kit(or package)
which includes Development Tools
(to provide an environment to develop your java programs)
JRE (to execute your java program).
JRE is only used by them who only wants to run the Java Programs
JVM is a very important part of both JDK and JRE. JVM is responsible
for executing the java program line by line hence it is also known as an
interpreter.
Note : JDK is only used by Java Developers.
8
Compiler & Interpreter
Just In Time (JIT) compilation is a way of executing
computer code that involves compilation during the
execution of a program at run time.
Ahead Of Time compilation (AOT) is the act
of compiling a higher-level programming language
such as C or C++, or an intermediate representation
such as Java bytecode into a native (system-dependent)
machine code so that the resulting binary file
can execute natively.
An interpreter is a computer program that directly executes instructions written
in a programming or scripting language, without requiring them previously
to have been compiled into a machine language program.
9
Compiler & Interpreter
The compiler translates the entire code at once whereas Java interpreter
translates the code line by line. Java compiler compiles the source code into bytecode.
JVM i.e. Java virtual machine is an interpreter that interprets the byte code.
Bytecode makes Java a platform-independent language.
10
to more descriptive...
11
Java Processing and Execution
• Begin with Java source code in text files: Model.java
• A Java source code compiler produces Java byte code
• Outputs one file per class: Model.class
• May be standalone or part of an IDE
• A Java Virtual Machine loads and executes class files
• May compile them to native code (e.g., x86) internally
12
Compiling and Executing a Java Program
13
Garbage Collector(GC)
Garbage Collection deals with finding and
deleting the garbage from memory.
In simple words, GC works in two simple steps known as Mark and Sweep:
Mark – it is where the garbage collector identifies
which pieces of memory are in use and which are not
Sweep – this step removes objects identified during the “mark” phase
14
How is Java different from C
- Major difference is that C is a structure oriented language and Java is an
object oriented language and has mechanism to define classes and objects.
- Java does not support an explicit pointer type
- Java does not include keywords like goto, sizeof and typedef.
- Java adds labeled break and continue statements.
- Java adds many features required for object oriented programming.
15
How is Java different from C++
- Java does not support operator over loading.
- Java does not support global variables. Every method and variable is
declared within a class and forms part of that class.
- Java does not support multiple inheritance
- In java objects are passed by reference only. In C++ objects may be
passed by value or reference.
- Java supports automatic garbage collection.
- break and continue statements have been enhanced in java to
accept labels as targets.
- Java has replaced the destructor function with a finalize() function.
- C++ supports exception handling that is similar to java's. However, in
C++ there is no requirement that a thrown exception be caught.
16
Why Java is Important ?
C/C++ languages are not portable and are not platform-independent languages.
The emergence of the World Wide Web, which demanded portable programs
Portability and security necessitated the invention of Java
17
Thanks…
Levent YILDIZ
levent.yildiz@bilgeadam.com

Introduction to java

  • 1.
    Introduction to Java LeventYILDIZ levent.yildiz@bilgeadam.com
  • 2.
    2 What is Java? A general-purpose object-oriented language. -Java is simple -Java is object-oriented -Java is distributed -Java is interpreted -Java is secure -Java is portable -Java’s performance -Java is multithreaded -Java is dynamic
  • 3.
    3 Birth and Growthof Java - James Gosling and Sun Microsystems - Oak - Green - Java, May 20, 1995, Sun World - WORA(Write once, run anywhere)
  • 4.
    4 JDK Editions - JavaStandard Edition (J2SE) J2SE can be used to develop client-side standalone applications or applets. - Java Enterprise Edition (J2EE) J2EE can be used to develop server-side applications such as Java servlets and Java ServerPages. - Java Micro Edition (J2ME). J2ME can be used to develop applications for mobile devices such as cell phones.
  • 5.
    5 History Java Evolutions - JDKBeta (1995) - JDK 1.0 (January 1996) - JDK 1.1 (February 1997) - J2SE 1.2 (December 1998) - J2SE 1.3 (May 2000) - J2SE 1.4 (February 2002) - J2SE 5.0 (September 2004) - Java SE 6 (December 2006) - Java SE 7 (July 2011) - Java SE 8 (March 2014) - Java SE 9 (September 2017) - Java SE 10 (March 2018) - Java SE 11 (September 2018) - Java SE 12 (March 2019) - Java SE 13 (September 2019) - Java SE 14 (March 2020)
  • 6.
    6 An Important Note Javaand Javascript are similar like Car and Carpet are similar. In Summary Java is not Javascript
  • 7.
    7 JDK, JRE, JVM JDKis a kit(or package) which includes Development Tools (to provide an environment to develop your java programs) JRE (to execute your java program). JRE is only used by them who only wants to run the Java Programs JVM is a very important part of both JDK and JRE. JVM is responsible for executing the java program line by line hence it is also known as an interpreter. Note : JDK is only used by Java Developers.
  • 8.
    8 Compiler & Interpreter JustIn Time (JIT) compilation is a way of executing computer code that involves compilation during the execution of a program at run time. Ahead Of Time compilation (AOT) is the act of compiling a higher-level programming language such as C or C++, or an intermediate representation such as Java bytecode into a native (system-dependent) machine code so that the resulting binary file can execute natively. An interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program.
  • 9.
    9 Compiler & Interpreter Thecompiler translates the entire code at once whereas Java interpreter translates the code line by line. Java compiler compiles the source code into bytecode. JVM i.e. Java virtual machine is an interpreter that interprets the byte code. Bytecode makes Java a platform-independent language.
  • 10.
  • 11.
    11 Java Processing andExecution • Begin with Java source code in text files: Model.java • A Java source code compiler produces Java byte code • Outputs one file per class: Model.class • May be standalone or part of an IDE • A Java Virtual Machine loads and executes class files • May compile them to native code (e.g., x86) internally
  • 12.
  • 13.
    13 Garbage Collector(GC) Garbage Collectiondeals with finding and deleting the garbage from memory. In simple words, GC works in two simple steps known as Mark and Sweep: Mark – it is where the garbage collector identifies which pieces of memory are in use and which are not Sweep – this step removes objects identified during the “mark” phase
  • 14.
    14 How is Javadifferent from C - Major difference is that C is a structure oriented language and Java is an object oriented language and has mechanism to define classes and objects. - Java does not support an explicit pointer type - Java does not include keywords like goto, sizeof and typedef. - Java adds labeled break and continue statements. - Java adds many features required for object oriented programming.
  • 15.
    15 How is Javadifferent from C++ - Java does not support operator over loading. - Java does not support global variables. Every method and variable is declared within a class and forms part of that class. - Java does not support multiple inheritance - In java objects are passed by reference only. In C++ objects may be passed by value or reference. - Java supports automatic garbage collection. - break and continue statements have been enhanced in java to accept labels as targets. - Java has replaced the destructor function with a finalize() function. - C++ supports exception handling that is similar to java's. However, in C++ there is no requirement that a thrown exception be caught.
  • 16.
    16 Why Java isImportant ? C/C++ languages are not portable and are not platform-independent languages. The emergence of the World Wide Web, which demanded portable programs Portability and security necessitated the invention of Java
  • 17.