This document provides an introduction to Java programming language. It discusses that Java was originally developed by Sun Microsystems in 1991 and was originally called OAK. It describes key characteristics of Java like being simple, object-oriented, distributed, interpreted, robust, secure, architecture-neutral, portable, multithreaded and dynamic. It also discusses features of the Java Virtual Machine like garbage collection, just-in-time compilation, security, and class loading. The document then covers Java versions, data types, naming conventions, object-oriented concepts like objects, classes, inheritance, polymorphism, abstraction and encapsulation. It concludes with brief descriptions of MySQL database.
This Powerpoint presentation covers following topics of C Plus Plus:
Features of OOP
Classes in C++
Objects & Creating the Objects
Constructors & Destructors
Friend Functions & Classes
Static data members & functions
To make this comparison we need to first consider the problem that both approaches help us to solve. When programming any system you are essentially dealing with data and the code that changes that data. These two fundamental aspects of programming are handled quite differently in procedural systems compared with object oriented systems, and these differences require different strategies in how we think about writing code.
This ppt tells about what is Java? What are the requirements of Java? And how it works? For more info about Java and free Java Projects Visit : http://s4al.com/category/study-java/
This Powerpoint presentation covers following topics of C Plus Plus:
Features of OOP
Classes in C++
Objects & Creating the Objects
Constructors & Destructors
Friend Functions & Classes
Static data members & functions
To make this comparison we need to first consider the problem that both approaches help us to solve. When programming any system you are essentially dealing with data and the code that changes that data. These two fundamental aspects of programming are handled quite differently in procedural systems compared with object oriented systems, and these differences require different strategies in how we think about writing code.
This ppt tells about what is Java? What are the requirements of Java? And how it works? For more info about Java and free Java Projects Visit : http://s4al.com/category/study-java/
Java is a popular High-level language. This ppt contains all the fundamentals of the Java programming language- Why one should learn Java, its history, features, applications and what type of career does Java developer have
Here I discuss about Java programming language and easiest way to solve programming problem. Java basic syntax and their uses are described briefly so that anyone can easily understand within very short time. If anyone follow the slide with proper way,I assure that he or she will find java programming interesting.
Java is a popular object-oriented, general-purpose, and class-based programming language. It has been created to have fewer implementation dependencies.
Developers around the world consider java as secure, fast, and a very reliable programming language. It is being used for developing simple to complex java applications used in mobiles, computers, data centres, scientific computers, ATM machines, etc.
2. 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.
4. 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,
In other languages these are additional APIs.
5. 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.
6. (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.
8. Data Types
In Java, there are two categories of data types-
1. Primitive Data Types 2. Non-Primitive Data Types
Data Type Default Type Default Size
boolean False 1 bit
char ‘u0000’ 2 byte
byte 0 1 byte
short 0 2 byte
int 0 4 byte
long 0L 8 byte
float 0.0f 4 byte
double 0.0d 8 byte
9. Naming Conventions
Java 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,
etc.
10. 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
11. 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.
12. 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.
13. Example of Class
class 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();
}
}
14. 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.
15. Types of Inheritance
Single
Multilevel
Hierarchical
Java does not support Multiple Inheritance because it creates the
ambiguity in the program.
16. 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.
17. 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.
18. 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).
19. 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.
20. 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.
21. 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.