Introduction

The Java programming language is a high-level language that can be described by all of the following keywords:
  • Simple Highperformance Distributed Dynamic Objectriented Portable Multithreaded Robust Secure Architecture neutral
  • Java is an Object Oriented Programming Language developed by James Gosling at Sun Microsystems.
  • It was originally called Oak.
  • It is a platform independent programming language.
  • Sun evolved it to be used for Internet Programming.

What is Java?

Java is a Programming Language .
  • Used to program web application, desktop applications, and native mobile apps for android and blackberry.
  • The relationship between above elements shown below:
  • A software developer writes program in the Java language that uses predefined software packages of the Java API
  • The developer compiles the programs using the Javacompiler.
  • This results in compiled bytecode.
  • Bytecode is in a form that can be executed on the Java virtual machine , the core of the Java runtime system.
  • One can think of the virtual machine as a microprocessor that is implemented in software and runs using the capabilities provided by their operating system and computer hardware.
  • The Java Virtual Machine is not a real microprocessor; the Java bytecode is interpreted, rather than executed directly in the native machine instructions of the host.
  • The Java runtime system consists of the virtual machineplus additional software, such as dynamic link libraries, that are needed to implement the Java API on your operating system and hardware.

Why Java?

Java provide us the following features:

Devloping tool for compiling, running, monitoring, debugging, and documenting your applications.The API provides the core functionality of the Java programming language. It offers a wide array of useful classes ready for use in your own applications.The JDK software provides standard mechanisms such as the Java Web Start software and Java Plug-In software for deploying your applications to end users.Integration libraries such as the Java IDL API, JDBC API, Java Naming and Directory Interface (JNDI) API, Java RMI, and Java Remote Method Invocation over Internet Inter-ORB Protocol Technology (Java RMI-IIOP Technology) enable database access and manipulation of remote objects.


There are two main reasons to program in Java
  1. It is an OOPS oriented language so development of huge enterprise applications is easy.
  2. It provides capabilities to develop robust, secure and distributed applications.

Using Advantages:
  • It is platform independent.
  • It supports interactive content on Web pages.
  • It is secured language.
  • The below figure summarizes the types of applications at which Java excels
  • Java Architecture
  • An interpreted language.
  • Complies with bytecode instead of machine language.
  • Application is portable between platforms.

JDK: Java Development Kit

A java development kit is a program development environment for writing java applets and applications.

It includes:
  1. Java compiler
  2. Java runtime
  3. Java jar (the packager)
  4. Java doc (the documentation)


Object Oriented Programming (OOP)

  • Java supports OOP concepts such as:
  • Classes and Objects
  • Abstraction
  • Polymorphism
  • Inheritance
  • Encapsulation
  • Java programs contain definitions and instantiations of classes.
  • Everything is encapsulated in a class.


Java Characteristics

  • Java is Portable: Write once, run anywhere
  • Secure: Can run “untrusted” code safely, robust memory management, designed for network programming.
  • Multi-threaded: Multiple simultaneous tasks.
  • Dynamic & extensible (loads of libraries): Classes stored in separate files, loaded only when needed.
  • Automatic Garbage Collection: Responsible for freeing any memory that can be freed, this happens automatically during the lifetime of the Java program, Programmer can request to GC for free or deallocate the memory.


How Does Java Help?

  • Large projects can be broken down into modules more easily.
  • Group work is easier.
  • Less chance of data corruption.
  • Aids reusability/extensibility.
  • Maintaining code is far easier.
  • Hides implementation details
  • You need to know what methods to call but don’t need to understand how the methods work to use them.

Java is not Java Script : JavaScript VS. Java

  • Compiled to bytecode
  • Not compiled interpreted at runtime
  • Function calls go through java native interface(JNI)
  • No native function calls
  • Write once, run anywhere
  • Support via web browsers
  • Runs in protected virtual machine(JVM)
  • Restricted to browser sandbox


Java Library

  • Java provides a huge library or collection of useful programs.
  • This library information is provided in the API (Application Programming Interface).


Java Security
  • Java does not use memory pointers explicitly.
  • All the programs in java run under an area known as the sand box .
  • A security manager determines the accessibility options of a class like reading and writing a file to the local disk.
  • Java uses a public key encryption system to allow java applications to transmit over the internet in a secure encrypted form.


A Simple Java Program

Here is a simple example of java program.
public class Hello
{
public static void main(String[] args){
System.out.println("Output is Hello CR Zaman");}
}
Output:Output is "Hello CR Zaman" 


Installing JAVA

Installing Java on Windows (JDK)

The Java Software Development Kit is an application created by Sun Microsystems to create and modify Java programs.


Install java on windows are:

Go to www.oracle.com/org. Click on Java SE Download.
Now, accept License Agreement.
Choose the correct Operating System corresponding to the specific JDK.
Once downloading completes, open the file and double click to run the installer.
You can change the installation path. Select appropriate features to install and click Next .
On the next screen you will see the status of installation. Click on Finish after installation is completed.
Open "System Properties“, click on the Advanced taband click on “environment variables”.
Now, set the path where JDK is installed in variable ‘path’.


Installing Java on Mac OS X (JDK)
  1. To install java on Mac follow these steps:
  2. Visit www.oracle.com and a download page appears.
  3. After you click on download, accept License Agreement.
  4. Click on Mac OS X x64.
  5. A .dmg file opens, click on the save file.
  6. Double click on the disk image and follow the wizard’s prompts to install the program on your computer.
  7. The Install Wizard displays the Welcome to JDK 8 installation screen. Click on Continue.
  8. Now, click on Install.
  9. It will ask you for the user id and password and then start installing.
  10. After that a confirmation screen appears, click Close to finish the installation process.

Translate

CR Zaman. Powered by Blogger.

Recent Posts

Popular Posts