History of Java:
Java was originally developed by James Gosling at Sun Microsystems (which has since been acquired by Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.
Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture. As of 2016, Java is one of the most popular programming languages in use, particularly for client-server web applications, with a reported 9 million developers.
1) James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The small team of sun engineers called Green Team.
2) Originally designed for small, embedded systems in electronic appliances like set-top boxes.
3) Firstly, it was called "Greentalk" by James Gosling and file extension was .gt.
4) After that, it was called Oak(Programming Language) and was developed as a part of the Green project.
Following are the features or buzzwords of Java language which made it popular:
1.Simple
2.Secure
3.Portable
4.Object-Oriented
5.Robust
6.Multithreaded
7.Architecture neutral
8.Interpreted
9.High Performance
10.Distributed
11.Dynamic
Simple:
•Java easy to learn
•It is easy to write programs using Java
•Expressiveness is more in Java.
•Most of the complex or confusing features in C++ are removed in Java like pointers etc..
Secure:
•Java provides data security through encapsulation.
•Also we can write applets in Java which provides security.
•An applet is a small program which can be downloaded from one computer to another automatically.
•There is no need to worry about applets accessing the system resources which may compromise security.
•Applets are run within the JVM which protects from unauthorized or illegal access to system resources.
Portable:
•Applications written using Java are portable in the sense that they can be executed on any kind of computer containing any CPU or any operating system.
•When an application written in Java is compiled, it generates an intermediate code file called as “bytecode”.
•Bytecode helps Java to achieve portability.
•This bytecode can be taken to any computer and executed directly.
Object - Oriented:
•Java follows object oriented model.
•So, it supports all the features of object oriented model like:
Encapsulation
Inheritance
Polymorphism
Abstraction
Robust:
•A program or an application is said to be robust(reliable) when it is able to give some response in any kind of context.
•Java’s features help to make the programs robust. Some of those features are:
1. Type checking
2. Exception handling
Multithreaded:
•Java supports multithreading which is not supported by C and C++.
•A thread is a light weight process.
•Multithreading increases CPU efficiency.
•A program can be divided into several threads and each thread can be executed concurrently or in parallel with the other threads.
•Real world example for multithreading is computer. While we are listening to music, at the same time we can write in a word document or play a game.
Architecture - Neutral:
•Bytecode helps Java to achieve portability.
•Bytecode can be executed on computers having any kind of operating system or any kind of CPU.
•Since Java applications can run on any kind of CPU, Java is architecture – neutral.
Interpreted and High Performance:
•In Java 1.0 version there is an interpreter for executing the bytecode. As interpreter is quite slow when compared to a compiler, java programs used to execute slowly.
•After Java 1.0 version the interpreter was replaced with JIT(Just-In-Time) compiler.
•JIT compiler uses Sun Microsystem’s Hot Spot technology.
•JIT compiler converts the byte code into machine code piece by piece and caches them for future use.
•This enhances the program performance means it executes rapidly.
Distributed:
•Java supports distributed computation using Remote Method Invocation (RMI) concept.
•The server and client(s) can communicate with another and the computations can be divided among several computers which makes the programs to execute rapidly.
•In distributed systems, resources are shared.
Dynamic:
•The Java Virtual Machine(JVM) maintains a lot of runtime information about the program and the objects in the program.
•Libraries are dynamically linked during runtime.
•So, even if you make dynamic changes to pieces of code, the program is not effected.
Comments:
Use // text when you want to comment a single line of code.
Use /* text */ when you want to comment multiple lines of code.
Use /** documentation */ when you would want to add some info about the program that can be used for automatic generation of program documentation.
Data Types:
Data types are used to declare variables. Data types specify the size and type of the values that can be stores in a variable. The data types in java under categories are as follows.
Integer Datatypes:
Types of Variable:
We will have detailed learning of these variables in next chapters.
Java was originally developed by James Gosling at Sun Microsystems (which has since been acquired by Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.
Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture. As of 2016, Java is one of the most popular programming languages in use, particularly for client-server web applications, with a reported 9 million developers.
1) James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The small team of sun engineers called Green Team.
2) Originally designed for small, embedded systems in electronic appliances like set-top boxes.
3) Firstly, it was called "Greentalk" by James Gosling and file extension was .gt.
4) After that, it was called Oak(Programming Language) and was developed as a part of the Green project.
Java Features or Java Buzzwords:
Following are the features or buzzwords of Java language which made it popular:
1.Simple
2.Secure
3.Portable
4.Object-Oriented
5.Robust
6.Multithreaded
7.Architecture neutral
8.Interpreted
9.High Performance
10.Distributed
11.Dynamic
Simple:
•Java easy to learn
•It is easy to write programs using Java
•Expressiveness is more in Java.
•Most of the complex or confusing features in C++ are removed in Java like pointers etc..
Secure:
•Java provides data security through encapsulation.
•Also we can write applets in Java which provides security.
•An applet is a small program which can be downloaded from one computer to another automatically.
•There is no need to worry about applets accessing the system resources which may compromise security.
•Applets are run within the JVM which protects from unauthorized or illegal access to system resources.
Portable:
•Applications written using Java are portable in the sense that they can be executed on any kind of computer containing any CPU or any operating system.
•When an application written in Java is compiled, it generates an intermediate code file called as “bytecode”.
•Bytecode helps Java to achieve portability.
•This bytecode can be taken to any computer and executed directly.
Object - Oriented:
•Java follows object oriented model.
•So, it supports all the features of object oriented model like:
Encapsulation
Inheritance
Polymorphism
Abstraction
Robust:
•A program or an application is said to be robust(reliable) when it is able to give some response in any kind of context.
•Java’s features help to make the programs robust. Some of those features are:
1. Type checking
2. Exception handling
Multithreaded:
•Java supports multithreading which is not supported by C and C++.
•A thread is a light weight process.
•Multithreading increases CPU efficiency.
•A program can be divided into several threads and each thread can be executed concurrently or in parallel with the other threads.
•Real world example for multithreading is computer. While we are listening to music, at the same time we can write in a word document or play a game.
Architecture - Neutral:
•Bytecode helps Java to achieve portability.
•Bytecode can be executed on computers having any kind of operating system or any kind of CPU.
•Since Java applications can run on any kind of CPU, Java is architecture – neutral.
Interpreted and High Performance:
•In Java 1.0 version there is an interpreter for executing the bytecode. As interpreter is quite slow when compared to a compiler, java programs used to execute slowly.
•After Java 1.0 version the interpreter was replaced with JIT(Just-In-Time) compiler.
•JIT compiler uses Sun Microsystem’s Hot Spot technology.
•JIT compiler converts the byte code into machine code piece by piece and caches them for future use.
•This enhances the program performance means it executes rapidly.
Distributed:
•Java supports distributed computation using Remote Method Invocation (RMI) concept.
•The server and client(s) can communicate with another and the computations can be divided among several computers which makes the programs to execute rapidly.
•In distributed systems, resources are shared.
Dynamic:
•The Java Virtual Machine(JVM) maintains a lot of runtime information about the program and the objects in the program.
•Libraries are dynamically linked during runtime.
•So, even if you make dynamic changes to pieces of code, the program is not effected.
Comments:
Use // text when you want to comment a single line of code.
Use /* text */ when you want to comment multiple lines of code.
Use /** documentation */ when you would want to add some info about the program that can be used for automatic generation of program documentation.
Data Types:
Data types are used to declare variables. Data types specify the size and type of the values that can be stores in a variable. The data types in java under categories are as follows.
Integer Datatypes:
Java supports '4' types of integers namely byte, short, int, long.
Types of Variable:
There are three types of variables in java
|
Local Variable
A variable that is declared inside the method is called local variable. |
Instance Variable
A variable that is declared inside the class but outside the method is called instance variable . It is not declared as static. |
Static variable
A variable that is declared as static is called static variable. It cannot be local. |
We will have detailed learning of these variables in next chapters.
No comments:
Post a Comment