java ppt

25
J A V A A Brief Introduction… Submitted by- Dilip Kumar Jangir Branch-Information Technology Roll No.-12EARIT019

Upload: dilip-kr-jangir

Post on 22-Jan-2017

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Java PPT

J AVAA Brief Introduction…

Submitted by-Dilip Kumar Jangir

Branch-Information TechnologyRoll No.-12EARIT019

Page 2: Java PPT

What is Java?

Java is a general purpose, high-level programming language developed by Sun Microsystems.

A small team of engineers, known as the Green Team, initiated the language in 1991. 

 Java was originally called OAK, and was designed for handheld devices and set-top boxes.

Today, Java is a commonly used foundation for developing and delivering content on the Web.

Page 3: Java PPT

Characteristics of Java

Java is- Simple. Object-oriented. Distributed. Interpreted. Robust. Secure. Architecture-neutral. Portable. Multithreaded. Dynamic.

Page 4: Java PPT

Java Virtual Machine(JVM)

Java is both compiled and interpreted. Source code is compiled into Java bytecode. Which is then interpreted by the Java Virtual Machine (JVM). Therefore bytecode is machine code for the JVM.

Java bytecode can run on any JVM, on any platform including mobile phones and other hand-held devices.

Networking and distribution are core features. Makes Java very good for building networked applications, server side

components, etc. In other languages these are additional APIs.

Page 5: Java PPT

Features of JVM

The Garbage Collector Runs in the background and cleans up memory while application is running. Java manages memory for you, the developer has no control over the

allocation of memory (unlike in C/C++). This is much simpler and more robust (no chance of memory leaks or

corruption). The Just In Time compiler (JIT)

Also known as “Hot Spot”. Continually optimises running code to improve performance. Can approach the speed of C++ even though its interpreted.

Page 6: Java PPT

(Cont.)Features of JVM

Security Java offers very fine control over what an application is allowed to do. E.g. Read/write files, open sockets to remote machines, discover information

about the users environment, etc. Used in Java Applets to create a “sandbox”. Stops a rogue applet attacking your

machine. Makes Java very safe, an important feature in distributed systems.

Class Loading Loading of bytecode into the virtual machine for execution. Code can be read from a local disk, over a network, or the Internet. Allows downloading of applications and applets on the fly.

Page 7: Java PPT

Versions of Java

JDK Alpha and Beta(1995) JDK 1.0(January 23,1996) JDK 1.1(February 19,1997) J2SE 1.2(December 8,1998) J2SE 1.3(May 8,2000) J2SE 1.4(February 6,2002) J2SE 5.0(September 30,2004) J2SE 6.0(December 11,2006) J2SE 7.0(July 28,2011) J2SE 8.0(March 18,2014) J2SE 9.0 & 10.0 are scheduled to release in 2016 & 2018

respectively.

Page 8: Java PPT

Data TypesIn Java, there are two categories of data types-1. Primitive Data Types 2. Non-Primitive Data Types

Data Type Default Type Default Sizeboolean False 1 bitchar ‘\u0000’ 2 bytebyte 0 1 byteshort 0 2 byteint 0 4 bytelong 0L 8 bytefloat 0.0f 4 bytedouble 0.0d 8 byte

Page 9: Java PPT

Naming ConventionsJava Naming Convention is a rule to follow as you decide what to name

your identifiers such as class, package, variable, constant, method, etc.

Name Conventions

Class Name Should start with uppercase letter and be a noun e.g. String, Colour, Button, Thread, etc.

Interface Name Should start with uppercase letter and be an adjective e.g. Runnable, ActionListener, etc.

Method Name Should start with lowercase letter and be a verb e.g. actionPerformed(), main), println(), etc.

Variable Name Should start with lowercase letter e.g. forstName, orderNumber, etc.

Package Name Should be in lowercase letter e.g. java, lang, sql,util, etc.

Constant Name Should be in uppercase letter e.g. RED, YELLOW, MAX_PRIORITY, etc.

Page 10: Java PPT

Java OOP’s Concept

Object Oriented Programming is a paradigm that provides many concepts such as inheritance, data binding, polymorphism etc.

Java concepts- Object Class Inheritance Polymorphism Abstraction Encapsulation

Page 11: Java PPT

Object

An entity that has state and behavior is known as an object e.g. chair, bike, marker, pen, table, car etc.

An object has three characteristics: State- represents data(value) of an object. Behaviour- represents the behaviour (functionality) of an

object such as deposit, withdraw, etc. Identity- Object identity is typically implemented via a unique

ID. The value of the ID is not visible to the external user but, it is used internally by the JVM to identify each object uniquely.

Object is an instance of a class.

Page 12: Java PPT

Class

A class is a group of objects that has common properties. It is a template or blueprint from which objects are created.

A class in java can contain- Data member Method Constructor Block Class and interface

By default, all data members and methods are private in Java.

Page 13: Java PPT

Example of Classclass Student{

int age;String name;void printData(){

System.out.println(“Name:”+name+”\nAge:”+age);

}public static void main(String args[]){

Student st=new Student();st.name=“John”;st.age=22;st.printData();

}}

Page 14: Java PPT

Inheritance

Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object.

The idea behind inheritance in java is that you can create new classes that are built upon existing classes.

Inheritance represents the IS-A relationship, also known as parent-child relationship.

It provides the mechanism of usability of code. The extends keyword is used to derive a new class from

existing class.

Page 15: Java PPT

Types of Inheritance

Single Multilevel Hierarchical

Java does not support Multiple Inheritance because it creates the ambiguity in the program.

Page 16: Java PPT

Polymorphism

Polymorphism in java is a concept by which we can perform a single action by different ways. Polymorphism is derived from 2 greek words: poly and morphs.

The word "poly" means many and "morphs" means forms. So polymorphism means many forms.

There are two types of polymorphism in java: Compiletime Polymorphism Runtime Polymorphism

We can perform polymorphism in java by method overloading and method overriding.

Page 17: Java PPT

Method Overloading

If a class have multiple methods by same name but different parameters, it is known as Method Overloading.

Method overloading increases the readability of the program.

There are two ways to overload the method in java: By changing number of arguments. By changing the data types.

Page 18: Java PPT

Method Overriding

If subclass (child class) has the same method as declared in the parent class, it is known as method overriding in java.

Usages- Method overriding is used to provide specific

implementation of a method that is already provided by its super class.

Method overriding is used for runtime polymorphism Rules-

method must have same name as in the parent class method must have same parameter as in the parent

class. must be IS-A relationship (inheritance).

Page 19: Java PPT

Abstraction

Abstraction is a process of hiding the implementation details and showing only functionality to the user.

Another way, it shows only important things to the user and hides the internal details.

For example sending SMS, you just type the text and send the message. You don't know the internal processing about the message delivery.

Abstraction lets you focus on what the object does instead of how it does it.

Page 20: Java PPT

Encapsulation

Encapsulation in java is a process of wrapping code and data together into a single unit, for example capsule i.e. mixed of several medicines.

We can create a fully encapsulated class in java by making all the data members of the class private.

Advantages: By providing only setter or getter method, you can

make the class read-only or write-only. It provides you the control over the data.

The Java Bean class is the example of fully encapsulated class.

Page 21: Java PPT

MySQL

The most popular Open Source Relational SQL database management system.

One of the best RDBMS being used for developing web-based software applications.

Uses a standard form of the well-known SQL data language, works on many operating systems and with many languages including PHP, PERL, C, C++, JAVA, etc.

Page 22: Java PPT

Online Exam

System

Page 23: Java PPT
Page 24: Java PPT
Page 25: Java PPT