Java is an object-oriented programming language that is designed to be platform independent, simple, secure, robust, and highly scalable. It achieves platform independence by using bytecodes that are executed by the Java Virtual Machine, allowing Java programs to run on any device that supports Java without recompilation. Java has become one of the most popular programming languages due to its wide adoption across servers and desktops.
2. What is Java
java is a Programming Language. It was first developed by
James Gosling at Sun Microsystems, which is now a part of
Oracle Corporation. It was released in 1995 as a part of
Sun Microsystems' Java Platform. The language has developed
much of its Syntax from C and C++.Java Application are usually
Complied to bytecode (Class File) that can run on any Java
Virtual Machine (JVM). Java is currently one of the most
popular programming languages being used.It has about 10 million
users.Java and JavaScript are not the same thing; in fact, they
are not even related. JavaScript is a Scripting Language which is used
mainly inside of Web Browsers.
3. why not just stick to Language
that have been used for decades:C , C++ ,
Cobol ,Fortran ,and So No? Relative to the
Other Programming Languages Used today,
Java is in infancy.(Sun Microsystem released
the First Version Of Java in 1995.) Yet Java
has become of most popular Language used in
programming today.
Java is an Object Oriented programming
Language With Syntax and Keyword almost
identical to C++ , another Object-Oriented
language that has been used extensively for
over 20 years.
4. Java Version
JDK 1.0 (January 23,1996)
JDK 1.1 (1997)
J2SE 1.2 (1998)
J2SE 1.3 (2000)
J2SE 1.4 (2002)
J2SE 5.0 (2004)
JAVA SE 6 (2006)
JAVA SE 7.0 (2011)
JAVA SE 8.0 (2012)
8. Object oriented programming is the catch phrase of
computer programming in the 1990's. Although object
oriented programming has been around in one form or
another since the Simula language was invented in the 1960's,
it's really begun to take hold in modern GUI environments like
Windows, Motif and the Mac. In object-oriented programs data
is represented by objects. Objects have two sections, fields
(instance variables) and methods. Fields tell you what an
object is. Methods tell you what an object does. These fields
and methods are closely tied to the object's real world
characteristics and behavior. When a program is run messages
are passed back and forth between objects. When an object
receives a message it responds accordingly as defined by its
methods.
Object oriented programming is alleged to have a number of
advantages including:
9. • Simpler, easier to read programs
• More efficient reuse of code
• Faster time to market
• More robust, error-free code
In practice object-oriented programs have been just as
slow, expensive and buggy as traditional
non-object-oriented programs. In large part this is because
the most popular object-oriented language is C++. C++ is a
complex, difficult language that shares all the obfuscation
of C while sharing none of C's efficiencies. It is possible in
practice to write clean, easy-to-read Java code.
In C++ this is almostunheard of outside of programming textbooks
10. Suppose that you want to assemble your own PC, you go to a hardware
store and pick up a motherboard, a processor, some RAMs, a hard disk, a
casing, a power supply, and put them together. You turn on the power,
and the PC runs. You need not worry whether the motherboard is a 4-
layer or 6-layer board, whether the hard disk has 4 or 6 plates; 3 inches or
5 inches in diameter, whether the RAM is made in Japan or Korea, and so
on. You simply put the hardware components together and expect the
machine to run. Of course, you have to make sure that you have the
correct interfaces, i.e., you pick an IDE hard disk rather than a SCSI hard
disk, if your motherboard supports only IDE; you have to select RAMs with
the correct speed rating, and so on. Nevertheless, it is not difficult to set
up a machine from hardware components.
How about software? Can you "assemble" a software
application by picking a routine here, a routine there,
and expect the program to run? The answer is
obviously no! Unlike hardware, it is very difficult
to "assemble" an application from software components.
Since the advent of computer 60 years ago, we have
written tons and tons of programs. However, for each new application,
we have to re-invent the wheels and write the program from scratch.
OOP
11. Why re-invent the wheels?
Traditional Procedural-Oriented languages
Can we do this in traditional procedural-oriented programming language
such as C, Fortran, Cobol, or Pascal?
Traditional procedural-oriented languages (such as C and Pascal) suffer
some notable drawbacks in creating reusable software components:
The programs are made up of functions. Functions are often
not reusable. It is very difficult to copy a function from one program and
reuse in another program because the the function is likely to reference
the headers, global variables and other functions. In other words,
functions are not well-encapsulated as a self-contained reusable unit.
The procedural languages are not suitable of high-level
abstraction for solving real life problems. For example, C programs uses
constructs such as if-else, for-loop, array, method, pointer, which are
low-level and hard to abstract real problems such as a Customer
Relationship Management (CRM) system or a computer soccer game.
(Imagine using assembly codes, which is a very low level code, to write a
computer soccer game. C is better but no much better.)
In brief, the traditional procedural-languages
separate the data structures and algorithms of
the software entities.
12. Why OOP?
Suppose that you want to assemble your own PC, you go to a hardware store and pick
up a motherboard, a processor, some RAMs, a hard disk, a casing, a power supply, and
put them together. You turn on the power, and the PC runs. You need not worry
whether the motherboard is a 4-layer or 6-layer board, whether the hard disk has 4 or 6
plates; 3 inches or 5 inches in diameter, whether the RAM is made in Japan or Korea,
and so on. You simply put the hardware components together and expect the machine
to run. Of course, you have to make sure that you have the correct interfaces, i.e.,
you pick an IDE hard disk rather than a SCSI hard disk, if your motherboard supports
only IDE; you have to select RAMs with the correct speed rating, and so
on. Nevertheless, it is not difficult to set up a machine from hardware components.
Hardware, such as computers and cars, are assembled from parts, which are reusable
components.
How about software? Can you "assemble" a software application by
picking a routine here, a routine there, and expect the program to run?
The answer is obviously no! Unlike hardware, it is very difficult
to "assemble" an application from software components.
Since the advent of
computer 60 years ago, we have written tons and tons of programs.
However, for each new application, we have to re-invent the
wheels and write the program from scratch.
Why re-invent the wheels?
13. Traditional Procedural-Oriented languages
Can we do this in traditional procedural-oriented programming
language such as C, Fortran, Cobol, or Pascal?
Traditional procedural-oriented languages (such as C and Pascal) suffer some
notable drawbacks in creating reusable software components:
*The programs are made up of functions. Functions are often not reusable.
It is very difficult to copy a function from
one program and reuse in another program because the the
function is likely to reference the headers, global variables and other
functions. In other words, functions are
not well-encapsulated as a self-contained reusable unit.
*The procedural languages are not suitable of high-level abstraction for
solving real life problems. For example,
C programs uses constructs such as if-else, for-loop, array,
method, pointer, which are low-level and hard to abstract real problems such
as a Customer Relationship Management (CRM) system or a computer soccer
game. (Imagine using assembly codes, which is a very low level code, to
write a computer soccer game. C is better but no much better.)
In brief, the traditional procedural-languages separate the data structures
and algorithms of the software entities.
14. *Functional programming treats the function as its most fundamental
unit of abstraction. In functional languages, functions are first-
class citizens, which means they can be passed as arguments to other
functions along with being normally evaluated to compute a value. On
the other hand, the JAVA programming language belongs to the
object-oriented paradigm, in which the fundamental unit of
abstraction is the object, and values are computed by asking
questions of objects by invoking their methods.
*DJ mixes the functional and object-oriented paradigms by adding
functions to the Java programming language as first-class citizens,
letting usexpress programs in a succinct, functional style, without
losing all the benefits of the object-oriented paradigm. Also, DJ is
fully compatible with Java RMI, so using the power of functional
abstraction we can drastically simplify the construction of type-safe
mobile applications and middleware
16. Eclipse is revolutionizing Java development by
bridging the gap between traditional static
languages (think C++) and dynamic OO
environments (think Smalltalk). Java developers
are used to the repetitive compile/debug/test
cycle typical of static languages. Eclipse uses a
combination of advanced techniques to emulate
a dynamic programming environment normally
associated with interpreted languages. This
amazing feat gives Java developers the benefits
of both worlds: a compiler still performs static
analysis, and the repetitive compile/debug
cycle yields to a smooth write/test activity.
17. A Java virtual machine (JVM) interprets compiled Java binary
code (called bytecode) for a computer's processor (or "hardware
platform") so that it can perform a Java program's instructions.
Java was designed to allow application programs to be built that
could be run on any platform without having to be rewritten or
recompiled by the programmer for each separate platform. A Java
virtual machine makes this possible because it is aware of the
specific instruction lengths and other particularities of the
platform.JIT compiling, not interpreting, is used in most JVMs
today to achieve greater speed.
*
18. *Java is Robust because it is highly supported
language. It is portable across many Operating
systems. Java also has feature of Automatic
memory management and garbage collection.
Strong type checking mechanism of Java also
helps in making Java Robust. Bugs, especially
system crashing bugs, are very rare in Java.
19. *The Java Platform provides a number of
features designed to improve the Securityof
Java applications. This includes enforcing
runtime constraints through the use of the Java
virpual mechine (JVM), a security manager
that sendboxes untrusted code from the rest of
the operating system, and a suite of
security APLs that Java developers can utilise.
Despite this, criticism has been directed at the
programming language, and Oracle, due to an
increase in malicious programs that revealed
security vulnerabilities in the JVM, which were
subsequently not properly addressed by Oracle
in a timely manner.
20. Java a complete object oriented programming
language is said to be platform independent or
architectural neutral as a java program do not
depend upon the operating system or hardware it is
running on. The Platform independent nature can be
interpreted by two things:
Operating System Independent: Independent of the
operating system on which your source code is being
run
These two points make it a platform independent
language. Hence, the user do not have to change the
syntax of the program according to the Operating
System and do not have to compile the program
again and again on different Operating Systems. The
meaning of this point can be understood as you read
further.Now talking about C,C++ they are a platform
dependent language's as the file which compiler of
C,C++ forms is a .exe(executable) file which is
operating system dependent
21. . The C++ program is controlled by the operating
system whereas, the execution of a Java program
is controlled by JVM( Java Virtual Machine).
The JVM is the main component of making the
java a platform independent language. For
building and running a java application we
need JDK (JAVA divelopment Kit) which comes
bundled with Java runtime environment(JRE) and
JVM. With the help of JDK the user compiles and
runs his java program. As the compilation of he
user source program (the java program which user
writes) starts the Java bite code is created i.e. a
.class file by the JRE. Now the JVM comes into
play, which is made to read and execute this
Javabytecode. The JVM is linked with operating
system and runs the Javabytecode to execute the
code depending upon operating system. Therefore,
a user can take this class file(JavaByteCode file)
formed to any operating system which is having a
JVM installed and can run his program easily
without even touching the syntax of a program or
source code is not even required
22. *. The .class file which consists the
Javabytecode is not user understandable and
can be interpreted by JVM only to build it into
the machine code.
The above information clearly states that why
java is a platform independent or
architectural neutral and why C,C++ are
platform Dependent.
A java program is compiled by writing your
program name with .javac.exe extension.
ex: program.javac.exe.
The above process creates a .class file which
consist of Javabytecode.
Now the user runs this code by writing class
file name with extension .java.
ex: program.java.
The JVM runs the program from here on and
the output of program is displayed to the
user.
23. Easy. JAVA is an architecture neutral language. As stated in
article1, the JAVA compiler generates JAVA Virtual Machine codes
instead of machine codes specific to the computer system we are
using.
These Virtual Machine codes, or JAVA bytecodes, are
all architecturally neutral; the compiled codes are executable on any
processors and systems, provided of course, that the JAVA Virtual
machine (interpreter) is installed in those systems. So, basically, the
compiler generates bytecode instructions which have nothing to do
with a particular computer architecture. Rather, they are designed to
be both easy to interpret on any machine and easily translated into
native code.
Being architecture neutral is a big chunk of being
portable, but there's more to it than that. Unlike C and C++, there
are no "implementation dependent" aspects of the specification. The
sizes of the primitive data types are specified, as is the behavior of
arithmetic on them. For example, "int" always means a signed two's
complement 32 bit integer, and "float" always means a 32-bit IEEE 754
floating point number. Making these choices is feasible in this day and
age because essentially all interesting CPU's share these
characteristics. The libraries that are a part of the system define
portable interfaces.
24. The best part is that the JAVA system itself is quite
portable. The new compiler is written in JAVA and
the runtime is written in C with a clean portability
boundary.
Okay, okay. JAVA is portable. So
what? Well, being architecturely-neutral, Java
applications are ideal for a diverse environment like
the Internet (!!). More of this in JAVA &WWW.
So, in general, JAVA appears to be a
dream come true. Portability of software across all
computing platforms with advantage over C++
over dynamic loading and garbage collection -
mundane sounding until you have to do it manually.
Does this mean there will be more JAVA and fewer
C++ applications written in the future? Yes,
25. *
*In Java, a Thread is essentially the Object that
represents one piece of work. When you start your
application and it starts to run, Java has
“spawned” (created) a Thread and thisThread is
what will carry out the work that your application
is meant to do. What’s interesting to note, is that
oneThread can only do one particular task at a
time. So that would mean it’s a bit of a bottleneck
if your entire application just works off of
one Thread right? Right!