Java Introduction
Java Introduction
• Network
• Interconnection of computers is called network. A network may contain two or
more computers connected with or without a cable.
•
• The primary purpose of a network is resources sharing, which means a computer
can share its resources, like data, memory, software, hardware, CPU, etc. with
other computers on the network.
• A Network with two computers
Client Server
C Program source code C Program source code Executable code Program output
• Execution of a Java Program
Java Program source code Byte code JVM converts byte code into machine code Program output
• What is the difference between an executable file and a class file?
• Exe file contains machine language instructions for the microprocessor and is
system dependent
• Class file contain byte code instructions for the JVM and is system independent.
• Why Java is suitable for internet?
• It is system independent and hence its programs can run any type of computer
system available on internet.
• Security.
INTRODUCTIONS TO JAVA
• James gosling and his team members were consuming a lot of coffee while
developing this language. They felt that they were able to develop a better
language because of the good quality coffee they consumed. So the coffee had its
own role in developing this language and good quality coffee was exported to the
entire world from a place called “Java island”. Hence the fixed the name of the
place for the language as Java. And the symbol for Java Language is coffee cup and
saucer.
• A popular interview question in java is “what is new in Java version X?”. Is that an
intelligent question is debatable. I have summarized below important new features
added in each major java release till now. I target to highlight important features
added in respective release. Apart from below list of features, every release has
enhancements and lots of bug fixes.
New features in Java 1.8
• Here are the new Java 1.8 features I'll talk about:
• Lambda expressions
• Remove the Permanent Generation
• Small VM
• Parallel Array Sorting
• Bulk Data Operations for Collections
• Define a standard API for Base64 encoding and decoding
• New Date & Time API
• Here is a brief summary of the enhancements included with the Java 8 release:
Lamda Expression and Virtual Extension Methods Highlighting feature of Java SE 8
is the implementation of Lamda expressions and supporting features to the Java
programming language and platform.
•
• It’s purely object oriented language
• Everything in java is an object
• All programs data reside inside the objects and classes
• Distributed
•
• It has strong network facilities. So we can create and application network
• Use java we can open and use the application on internet. This facility helps the
users from different place to work together on a single application
• Robustness
•
• In many languages attention is not given an memory management and exception
concept. But in java we are use the advanced techniques called garbage collections
and exception handling
•
• Secure
• Java is a programming language on internet so security becomes an important
issue. Before a java code from internet is interpreted, and security check is applied
on internet.
•
• Digitally signing
•
• Java has a facility to sign our java code before send it.
• At the receiving and the receiver can tally the signature if the signature is matches,
the codes reached correctly this concepts is called digitally signing.
•
• Architecture Natural Language
Source code
Java compiler
Byte code
011011011
100110010
Java compiler generates platform independent code from the source code. It cable to
run any type of system that is called byte code (class file)
• Portable
• In java size of primitive data types or machine independent so java is portable
language
• High Performance
• Since java interpreter uses by the codes so the performance is high
•
• Multi threaded and Interactive
• Multi threaded means handling more than one jobs at a time
• Java also supports by interactive programs
• Java Developer Kit contains tools needed to develop the Java programs, and JRE to
run the programs. The tools include compiler (javac.exe), Java application launcher
(java.exe), Appletviewer, etc…
Compiler converts java code into byte code. Java application launcher opens a JRE,
loads the class, and invokes its main method.
• JRE = JVM + Java Packages Classes(like util, math, lang, awt,swing etc)+runtime
libraries.
• Java Runtime Environment contains JVM, class libraries, and other supporting files.
It does not contain any development tools such as compiler, debugger, etc.
Actually JVM runs the program, and it uses the class libraries, and other supporting
files provided in JRE. If you want to run any java program, you need to have JRE
installed in the system.
• JRE (Java Realtime Environment) is a software package that provides Java class
libraries, along with Java Virtual Machine (JVM), and other components to run
applications written in Java programming. JRE is the superset of JVM.
JVM (Java Virtual Machine):
• When we compile a Java file, output is not an .exe but it’s a .class file. This .class is
known as Java byte code, It has the Java byte codes which can be understood by
JVM.
• Java Virtual Machine interprets the byte code into the machine code and execute
it. It is responsible for all the things like garbage collection, array bounds checking,
etc… JVM is a cornerstone of the write-once run-anywhere value of Java
programs.
• Note: JVM is platform dependent but it makes the Java platform independent.
• JIT also known as dynamic translation. JIT is the part of the Java Virtual Machine
(JVM) that helps to speed up the execution time. Parts of the byte code that have
similar functionality at the same time complied by JIT and saves time needed for
compilation. It translates the instruction set of a Java virtual machine (JVM) to the
instruction set of a specific CPU.