Java Programming Language

Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented,[12] and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA),[13] meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.[14] Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture. As of 2015, Java is one of the most popular programming languages in use,[15][16][17][18] particularly for client-server web applications, with a reported 9 million developers.[citation needed] 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.

The original and reference implementation Java compilers, virtual machines, and class libraries were originally released by Sun under proprietary licences. As of May 2007, in compliance with the specifications of the Java Community Process, Sun relicensed most of its Java technologies under the GNU General Public License. Others have also developed alternative implementations of these Sun technologies, such as the GNU Compiler for Java (bytecode compiler), GNU Classpath (standard libraries), and IcedTea-Web (browser plugin for applets).

History

The Java programming Language evolved from a language named Oak. Oak was developed in the early nineties at Sun Microsystems as a platform-independent language aimed at allowing entertainment appliances such as video game consoles and VCRs to communicate . Oak was first slated to appear in television set-top boxes designed to provide video-on-demand services. Just as the deals with the set-top box manufacturers were falling through, the World Wide Web was coming to life. As Oak’s developers began to re cognize this trend, their focus shifted to the Internet and WebRunner, an Oak-enabled browser, was born. Oak’s name was changed to Java and WebRunner became the HotJava web browser. The excitement of the Internet attracted software vendors such that Jav a development tools from many vendors quickly became available. That same excitement has provided the impetus for a multitude of software developers to discover Java and its many wonderful features.

Significant Language Features

Platform Independence - Java compilers do not produce native object code for a particular platform but rather ‘byte code’ instructions for the Java Virtual Machine (JVM). Making Java code work on a particular platform is then sim ply a matter of writing a byte code interpreter to simulate a JVM. What this all means is that the same compiled byte code will run unmodified on any platform that supports Java.

Object Orientation - Java is a pure object-oriented language. This means that everything in a Java program is an object and everything is descended from a root object class.

Rich Standard Library - One of Java’s most attractive features is its standard library. The Java environment includes hundreds of classes and methods in six major functional areas.

Language Support classes for advanced language features such as strings, arrays, threads, and exception handling.

Utility classes like a random number generator, date and time functions, and container classes.

Input/output classes to read and write data of many types to and from a variety of sources.

Networking classes to allow inter-computer communications over a local network or the Internet.

Abstract Window Toolkit for creating platform-independent GUI applications.

Applet is a class that lets you create Java programs that can be downloaded and run on a client browser.

Applet Interface - In addition to being able to create stand-alone applications, Java developers can create programs that can downloaded from a web page and run on a client browser.

Familiar C++-like Syntax - One of the factors enabling the rapid adoption of Java is the similarity of the Java syntax to that of the popular C++ programming language.

Garbage Collection - Java does not require programmers to explicitly free dynamically allocated memory. This makes Java programs easier to write and less prone to memory errors.

What Can Java Technology Do?

The general-purpose, high-level Java programming language is a powerful software platform. Every full implementation of the Java platform gives you the following features:

Development Tools: The development tools provide everything you'll need for compiling, running, monitoring, debugging, and documenting your applications. As a new developer, the main tools you'll be using are the javac compiler, the java launcher, and the javadoc documentation tool.

Application Programming Interface (API): 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. It spans everything from basic objects, to networking and security, to XML generation and database access, and more. The core API is very large; to get an overview of what it contains, consult the latest documentation version of Java Platform Standard Edition.

Deployment Technologies: 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.

User Interface Toolkits: The JavaFX, Swing, and Java 2D toolkits make it possible to create sophisticated Graphical User Interfaces (GUIs).

Integration Libraries: 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.

Why Choose Java?

Java was designed with a few key principles in mind:

Easy to Use: The fundamentals of Java came from a programming language called c++. Although c++ is a powerful language, it was felt to be too complex in its syntax, and inadequate for all of Java's requirements. Java built on, and improved the ideas of c++, to provide a programming language that was powerful and simple to use.

Reliability: Java needed to reduce the likelihood of fatal errors from programmer mistakes. With this in mind, object-oriented programming was introduced. Once data and its manipulation were packaged together in one place, it increased Java’s robustness.

Secure: As Java was originally targeting mobile devices that would be exchanging data over networks, it was built to include a high level of security. Java is probably the most secure programming language to date.

Platform Independent: Programs needed to work regardless of the machine they were being executed on. Java was written to be a portable language that doesn't care about the operating system or the hardware of the computer.

The team at Sun Microsystems were successful in combining these key principles, and Java's popularity can be traced to it being a robust, secure, easy to use, and portable language.

Java platform overview

Java technology is used to develop applications for a wide range of environments, from consumer devices to heterogeneous enterprise systems. In this section, get a high-level view of the Java platform and its components. See Resources to learn more about the Java platform components discussed in this section.

The Java language

Like any programming language, the Java language has its own structure, syntax rules, and programming paradigm. The Java language's programming paradigm is based on the concept of object-oriented programming (OOP), which the language's features support.

The Java language is a C-language derivative, so its syntax rules look much like C's: for example, code blocks are modularized into methods and delimited by braces ({ and }), and variables are declared before they are used.

Structurally, the Java language starts with packages. A package is the Java language's namespace mechanism. Within packages are classes, and within classes are methods, variables, constants, and so on. You'll learn about the parts of the Java language in this tutorial.

The Java compiler

When you program for the Java platform, you write source code in .java files and then compile them. The compiler checks your code against the language's syntax rules, then writes out bytecodes in .class files. Bytecodes are standard instructions targeted to run on a Java virtual machine (JVM). In adding this level of abstraction, the Java compiler differs from other language compilers, which write out instructions suitable for the CPU chipset the program will run on.

The JVM

At run time, the JVM reads and interprets .class files and executes the program's instructions on the native hardware platform for which the JVM was written. The JVM interprets the bytecodes just as a CPU would interpret assembly-language instructions. The difference is that the JVM is a piece of software written specifically for a particular platform. The JVM is the heart of the Java language's "write-once, run-anywhere" principle.

Your code can run on any chipset for which a suitable JVM implementation is available. JVMs are available for major platforms like Linux and Windows, and subsets of the Java language have been implemented in JVMs for mobile phones and hobbyist chips.

The garbage collector

Rather than forcing you to keep up with memory allocation (or use a third-party library to do this), the Java platform provides memory management out of the box. When your Java application creates an object instance at run time, the JVM automatically allocates memory space for that object from the heap, which is a pool of memory set aside for your program to use. The Java garbage collector runs in the background, keeping track of which objects the application no longer needs and reclaiming memory from them. This approach to memory handling is called implicit memory management because it doesn't require you to write any memory-handling code. Garbage collection is one of the essential features of Java platform performance.

The Java Development Kit

When you download a Java Development Kit (JDK), you get — in addition to the compiler and other tools — a complete class library of prebuilt utilities that help you accomplish just about any task common to application development. The best way to get an idea of the scope of the JDK packages and libraries is to check out the JDK API documentation (see Resources).

The Java Runtime Environment

The Java Runtime Environment (JRE; also known as the Java runtime) includes the JVM, code libraries, and components that are necessary for running programs written in the Java language. It is available for multiple platforms. You can freely redistribute the JRE with your applications, according to the terms of the JRE license, to give the application's users a platform on which to run your software. The JRE is included in the JDK.

Object-oriented programming concepts

The Java language is (mostly) object-oriented. If you haven't used an object-oriented language before, its concepts might seem strange at first. This section is a short introduction to OOP language concepts, using structured programming as a point of contrast.

Simula is considered as the first object-oriented programming language. The programming paradigm where everything is represented as an object, is known as truly object-oriented programming language.

Smalltalk is considered as the first truly object-oriented programming language.

OOPs (Object Oriented Programming System)

Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance by providing some concepts:

Object

Class

Inheritance

Polymorphism

Abstraction

Encapsulation

Object

Any entity that has state and behavior is known as an object. For example: chair, pen, table, keyboard, bike etc. It can be physical and logical.

Class

Collection of objects is called class. It is a logical entity.

Inheritance

When one object acquires all the properties and behaviours of parent object i.e. known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism.

Polymorphism

When one task is performed by different ways i.e. known as polymorphism. For example: to convense the customer differently, to draw something e.g. shape or rectangle etc.

In java, we use method overloading and method overriding to achieve polymorphism.

Another example can be to speak something e.g. cat speaks meaw, dog barks woof etc.

Abstraction

Hiding internal details and showing functionality is known as abstraction. For example: phone call, we don't know the internal processing.

In java, we use abstract class and interface to achieve abstraction.

Encapsulation

Binding (or wrapping) code and data together into a single unit is known as encapsulation. For example: capsule, it is wrapped with different medicines.

A java class is the example of encapsulation. Java bean is the fully encapsulated class because all the data members are private here.

Advantage of OOPs over Procedure-oriented programming language

1)OOPs makes development and maintenance easier where as in Procedure-oriented programming language it is not easy to manage if code grows as project size grows.

2)OOPs provides data hiding whereas in Procedure-oriented prgramming language a global data can be accessed from anywhere.

3)OOPs provides ability to simulate real-world event much more effectively. We can provide the solution of real word problem if we are using the Object-Oriented Programming language.

CORE JAVA SYLLABUS

INTRODUCTION

What is java?

Why Java?

Role of Java Programmer in Industry

Features of Java Language

JVM –The heart of Java

Java’s Magic Bytecode

LANGUAGE FUNDAMENTALS

THE JAVA ENVIRONMENT

Installing Java (JDK, JRE)

Java Program Development

Java Source File Structure

Compilation

Execution

BASIC LANGUAGE ELEMENTS

Identifiers, Modifiers

Keywords,Comments

Operators, Loops

Conditional Statements

Defining Package

CLASSPATH Setting for Packages

Import a package

Naming Convention for Packages and Class

PROGRAMMING

Class Fundamentals

Object & Object reference

Creating and Operating Objects

Variables and data types

Constructor & initialization code block.

Methods, Defining Methods

Argument Passing Mechanism

Use of “this “ keyword

Working of Main method

Command line argument

System.out.println

INHERITANCE MEANS EXTENDING CLASSES

Concept of Inheritance and Need of Inheritance

Use and Benefits of Inheritance in OOP

Inheriting Data Members and Methods

Role of Constructors in inheritance

Type Compatibility and Conversion Implementing Interfaces

SOME IMPORTANT TOPICS IN JAVA

Abstract Class & Interfaces

Overloading, Overriding

Dealing with Static Members

Single Copy Concept of Static

Garbage Collection

Finalize () Method

Var Argument

Wrapper Classes

Enumeration

Inner Classes

Generalization

Tokenization

Single Ton Pattern

Decorator Pattern

OOPS CONCEPTS

Object Orientation

Abstraction

Encapsulation

Inheritance

Polymorphism

ARRAY

Defining an Array

Types of Array

Initializing & Accessing Array

Array of Arrays

Anonymous Array

STRING

Constant Pool

Immutability in String

Operation on String

String Buffer

String Builder

EXCEPTION HANDLING

The Idea behind Exception

Types of Exceptions

Exceptions & Errors

Control Flow in Exceptions

JVM reaction to Exceptions

Use of try, catch, finally, throw, throws in Exception Handling.

In-built and User Defined Exceptions

Assertion

Some new features add-on in Java 7

THREAD

Understanding Threads

Thread Life-Cycle

Runnable Interface

Defining, Instantiating, and

Starting Threads

Thread Priorities

Synchronization

Inter Communication of Threads

Critical Factor in Thread DeadLock

Some new features add-on in Java 7

INPUT/OUTPUT, FILE HANDLING (JAVA.IO PACKAGE)

Streams and the new I/O Capabilities

Understanding Streams

The Classes for Input and Output

The Standard Streams

Working with File Object

File I/O Basics

Reading and Writing to Files

Buffer and Buffer Management

Read/Write Operations with File Channel

Console and Scanner Classes

Serialization

Some new features add-on in Java 7

JAVA UTILITIES (JAVA.UTIL PACKAGE)

THE COLLECTION FRAMEWORK

Collections of Objects

Collection Types

Use of collection

Set

List

Queue

Map

Comparable and comparator Interfaces

Creating your own collection

Generic and Generic Collection

EVENT HANDLING

Event- Handling Process

Event-Handling Mechanism

The Delegation Model of Event Handling

Event Classes

Event Sources

Event Listeners

Anonymous Inner classes a Short –cut to Event Handling Event Types & Classes

DATA BASE PROGRAMMING USING JDBC

Introduction to JDBC

JDBC Drivers & Architecture

Statements

Glob and Blob

PART-2 (J2EE)

FUNDAMENTALS OF J2EE

What is J2EE?

What is server application?

Server (Apache)

Container (Tomcat)

Why needed a browser in server application?

SERVLET

Servlet: What and Why? Basics of Web Servlet API Servlet Interface GenericServlet HttpServlet Servlet Life Cycle Working with Apache Tomcat Server Steps to create a servlet in Tomcat How servlet works? servlet in Myeclipse servlet in Eclipse servlet in Netbeans

SERVLETREQUEST

ServletRequest methods Registration example with DB

SERVLET COLLABORATION

RequestDispatcher sendRedirect

SERVLETCONFIG

ServletConfig methods

ServletConfig example

SERVLETCONTEXT

ServletContext methods

ServletContext example

ATTRIBUTE

How to set, get and remove example?

Session Tracking

Cookies Hidden Form Field URL Rewriting HttpSession

EVENT AND LISTENER

Filter Authentication Filter FilterConfig Useful examples

ServletInputStream and ServletOutputStream

Annotation Servlet

Project Development

JSP (JAVA SERVER PAGES)

What is JSP?

Life Cycle of JSP

Various tags in JSP

Use Bean tag in JSP

EL Expression

JSTL (Java Standard Tag Libraries)

Custom Tag

SCRIPTING ELEMENTS

scriptlet tag expression tag declaration tag

9 IMPLICIT OBJECTS

out request response config application session pageContext page exception

DIRECTIVE ELEMENTS

page directive include directive taglib directive

EXCEPTION HANDLING

Action Elements

jsp:forward

jsp:include

Bean class

jsp:useBean

jsp:setProperty & jsp:getProperty

Displaying applet in JSP

EXPRESSION LANGUAGE

MVC in JSP

JSTL

CUSTOM TAGS

Custom Tag : What and Why? Custom Tag API? Custom Tag Example Attributes Iteration Custom URI

Project Development in JSP

JAVAMAIL API

Sending Email Sending email through Gmail server Receiving Email Sending HTML content

DESIGN PATTERN

Singleton DAO DTO MVC Front Controller

Factory Method etc.

JUNIT

JUnit

JUnit: What and Why? Types of Testing Annotations used in JUnit Assert class Test Cases

MAVEN

Maven: What and Why? Ant Vs Maven How to install Maven? Maven Repository Understanding pom.xml Maven Example Maven Web App Example Maven using Eclipse

PART-3 (Frameworks)

STRUTS

What are application frameworks?

Why we need frameworks?

Why we need Struts?

Model1 vs Model2

Struts2 Features

Steps to create Struts2 application Understanding Action class Understanding struts.xml file Struts2 in Eclipse IDE Struts2 in Myeclipse IDE

Struts control flow and architecture

Dao Pattern, Default stack

Interceptors, Mappings

Struts APIs

CORE COMPONENTS

Interceptors ValueStack ActionContext

ActionInvocation OGNL

STRUTS 2 ARCHITECTURE

Struts2 Action

Action Interface ActionSupport class

Struts2 Configuration

multi configuration multi namespace

INTERCEPTORS

Custom Interceptor : Life Cycle of Interceptor params interceptor execAndWait interceptor prepare interceptor modelDriven interceptor exception interceptor fileUpload interceptor

STRUTS 2 VALIDATION

Custom Validation : workflow interceptor Input Validation : validation interceptor Ajax Validation : jsonValidation interceptor

AWARE INTERFACES

ServletActionContext

SessionAware Login and Logout Application ServletContextAware

STRUTS2 WITH I18N

Zero Configuration

By convention By annotation

Project Development in Struts2

EJB 3

INTRODUCTION TO JAVAEE

The Need for JavaEE. Overview on the JavaEE Architecture 1 tier 2 tier 3 tier N tier JavaEE Key Standards

INTRODUCTION TO EJB3

The EJB Model Key Services of the Application Server

DEVELOPING SESSION BEANS

Stateless Session Beans Stateful Session Beans Packaging Writing Clients

USING DEPENDENCY INJECTION

No More JNDI Injection of EJBContext

JMS

JMS Overview JMS Messaging Domains Example of JMS using Queue Example of JMS using Topic

WEB TECHNOLOGY

HTML 5

Introduction to HTML HTML Tags Creating Forms Creating tables Managing home page

CSS

Introduction to CSS

Three ways to use CSS CSS Properties Designing website Working with Templates

JAVASCRIPT

Introduction to Javascript Three ways to use Javascript Working with events Client-side Validation

JQUERY

Introduction to JQuery Validation using JQuery JQuery Forms JQuery Examples

AJAX

Introduction to AJAX Servlet and JSP with AJAX Interacting with database

HIBERNATE

BASICS OF HIBERNATE

Hibernate Introduction Hibernate Architecture Understanding First Hibernate application

HIBERNATE WITH IDE

Hibernate in Eclipse

Hibernate in MyEclipse

HIBERNATE APPLICATION

Hibernate with annotation Hibernate Web application Hibernate Generator classes Hibernate Dialects

HIBERNATE LOGGING

Hibernate with Log4j 1 Hibernate with Log4j 2

INHERITANCE MAPPING

Table Per Hierarchy Table Per Hierarchy using Annotation Table Per Concrete Table Per Concreteusing Annotation Table Per Subclass Table Per Subclass using Annotation

COLLECTION MAPPING

Mapping List One-to-many by List using XML Many to Many by List using XML One To Many by List using Annotation Mapping Bag

One-to-many by Bag Mapping Set One-to-many by Set Mapping Map Many-to-many by Map Bidirectional Lazy Collection

COMPONENT MAPPING

Association Mapping

One-to-one using Primary Key One-to-one using Foreign Key

Hibernate Caching

First Level Cache Second Level Cache

Integration

Hibernate and Struts Hibernate and Spring

SPRING

CORE SPRING

Basics of Spring

What is Spring Spring Modules Spring Application

Spring with IDE

Spring in Myeclipse Spring in Eclipse

IOC CONTAINER

Dependency Injection

Constructor Injection CI Dependent Object CI with collection CI with Map CI Inheriting Bean Setter Injection SI Dependent Object SI with Collection SI with Map CI vs SI Autowiring Factory Method

SPRING AOP

AOP Terminology AOP Implementations Pointcut Advices

SPRING JDBC

JdbcTemplate Example PreparedStatement ResultSetExtractor

RowMapper NamedParameter SimpleJdbcTemplate

SPRING WITH ORM

Spring with Hibernate Spring with JPA

SPEL

SpEL Examples Operators in SpEL variable in SpEL

SPRING 3 MVC

Remoting with Spring

Spring with RMI Http Invoker Hessian Burlap Spring with JMS

OXM FRAMEWORKS

Spring with JAXB Spring with Xstream Spring with Castor

SPRING JAVA MAIL

Web Integration

Spring with Struts2

Login and Logout Application

Springing into Action

Basic Bean writing

Advanced Bean writing

Advising Beans

ENTERPRISE SPRING

Hitting the database

Managing transactions

Securing Spring

Spring messaging

Spring and Enterprise Java Beans

Accessing Enterprise Services

CLIENT-SIDE SPRING

Handling web requests

Rendering web views

Using Spring web flow

Integrating with other web framework