SlideShare a Scribd company logo
1 of 30
INTRODUCTION OF JAVA
PRESENTED BY,
RANJITHAM.N
INTRODUCTION TO JAVA:
• Java was originally developed by James Gosling at Sun
Microsystems .
• It was released in 1995.
• Java applications are typically compiled to Bytecode that can run on
any Java Virtual Machine.
• The language derives much of its syntax from C and C++.
WHAT IS JAVA?
• Java is a computer programming language.
• It is concurrent and written in the concept of Class and Object.
• Purely Object oriented programming.
• Platform independent.
FEATURES OF JAVA:
• Simple
• Secure
• Portable
• Object oriented
• Multithreaded
• High performance
• Dynamic
• interpreted
APPLICATIONS OF JAVA:
• Java program can run on any PC or any operating system.
• Simple and Standalone.
• Mobile application.
• Enterprise.
• Web application
HOW JAVA DIFFER FROM C++:
JAVA PROGRAMMING C++ PROGRAMMING
• Completely object oriented language. • partially object oriented language.
• It is portable. • It is non portable.
• Both compiler and interpreter are
used.
• Only compiler is used.
• Pointer is not used in java. • Pointer is used in c++.
• no global variable is present. • Global variable is present.
• Operator overloading is not possible. • Operator overloading is possible.
• Scope resolution operator is used. • Scope resolution operator is used.
HOW JAVA DIFFER FROM C:
JAVA PROGRAMMING C PROGRAMMING
• Object oriented language. • Function oriented language.
• It is built into long security. • It has limited security.
• Allocating memory by memory
function.
• Allocation of memory by new
function.
• Memory address is through pointers. • Memory address is through reference.
OBJECT ORIETNED PROGRAMMING CONCEPTS:
• Object
• Class
• Data abstraction
• Data encapsulation
• Polymorphism
• Inheritance
• Dynamic binding
• Message communication
OBJECT:
• Basic runtime entity.
• Represent user defined datatype.
• Object interact by sending messages to one another.
CLASS:
• Collection of similar objects.
• User defined datatype.
• Eg: Fruit.
DATA ABSTRACTION:
• The act of representing essential feautures without including the
background details.
• Insulation of the data from direct access by the program is called as
data hiding.
DATA ENCAPSULATION:
• Wrapping up of data and methods into a single unit.
INHERITANCE:
• Objects of one class acquired the properties of objects of another
class.
• Supports the concepts of hierarchical classification.
• Provides the idea of reusability.
• Can add additional features to an existing class without modifying
it.
TYPES OF INHERITANCE:
• Single inheritance
• Multiple inheritance
• Multilevel inheritance
• Hierarchical inheritance
• Hybrid inheritance.
POLYMORPHISM:
• Ability to take more than one form.
• Exhibit different behaviour in different instances.
• Single function name can be used to handle different number an
different types of arguments.
TYPES:
• Dynamic polymorphism.
• Static polymorphism.
DYNAMIC BINDING:
• The code assosiated with the given procedure call is not known
until the time of the call at runtime.
• Assosiated with the polymorphism an inheritance.
• A procedure call associated with a polymorphic reference depends
on the dynamic type of the reference.
MESSAGE COMMUNICATION:
• Program consists of a set of objects that communicate with each
other.
Involves the following basic steps:
• creating classes that define objects and their behaviour .
• creating objects from class definition.
• establishing communications among objects.
DEFINING THE CLASS:
• Once the class type has been defined,we can create the variables.
• Variables are termed as instances of classes.
SYNTAX:
class classname [extends superclassname]
{
fields declaration;
method declaration;
}
METHODS:
• Methods are declared inside the body of the class.
• Methods that are necessary to manipulate the data
contained in the class.
SYNTAX:
type methodname (parameter_list)
{
method_body;
}
METHOD DECLARATION:
• The name of the methods(method name).
• The type of the value the method returns(type).
• A list of parameters(parameter_list).
• The body of the method.
public class Cse
{
public void show()
{
System.out.println("Sample Method ");
}
public static void main(String args[])
{
Cse obj=new Cse1();
obj.show();
}
}
PROGRAM FOR METHOD DECLARATION:
FINALIZER METHODS:
• Java supports a concept called Finalization.
• Java runtime is an automatic garbage collecting system.
• Automatically frees up the memory resources used by the objects.
SYNTAX
protected void finalize()
{
…
...
}
ACCESS SPECIFIERS:
• It is restrict the place where we are using the member of the
class.
• It is used to access the member.
THREE TYPES:
• private
• protected
• public
STATIC:
• Can be called without objects.
• Initialization is not necessary.
• Static function can access only the static variables.
PROGRAM:
class sample
{
public static void main(String[] args) {
display(); }
static void display() {
System.out.println(“hai hello");
} }
STATIC MEMBER:
• The member that are declared static as shown above are static
member.
• Gets memory only in class area at the time of class loading.
• Memory efficient.
Types of static member:
• static variable
• static method
• static block
STATIC MEMBER:
class math
{
Static float mul(float x.float y)
{
return x*y;
}
Static float div(float x,float y)
{
return x/y;
}
}
class math
{
public void static main(string args[])
{
float a=math.mul(4.0.5.0);
float b=math.div(a,2.0);
System.out.println(“b=“+b);
}
}
STATIC VARIABLE
• Gets memory only in class area at the time of class loading.
• Memory efficient.
Class Stu
{
int rollnumber;
string name;
Static string name=“ITS”
Stu( int r.string n)
{
rollnumber=r;
name=n;
}
Void display()
{
System.out.println(“+rollnumber+”
”+name+””+college+”);
}
Public Static void main (string args[])
{
Stu s1=new stu(111,”karan”);
Stu s1=new stu(222”priya”);
S1.display();
S2.display();
}
STATIC METHOD:
• It belongs to the class rare than the object of the class .
• Invoked without the need for creating a instance of class.
• It can access static data member and can change value of it.
class Calculate
{
Static int cube(int x);
return x*x*x;
}
STATIC BLOCK:
 It is used to initialize the static data member.
 Executed before main method at the time of class loading.
Program:
class cse
{
Static { system.out.println(“static block is invoked”);}
public static main(string args[]);
}
CONSTRUCTOR:
• It is a special method where will invoke automatically when the time
of object creation.
Rules:
• Constructor name and the class name should be same.
• It wont have any return type.
• It is used to assign the value to the instance variable.
• It can be with parameter or without parameter..
PROGRAM FOR CONSTRUCTORS:
public class Cube1 {
int length;
int breadth;
int height;
public int getVolume() {
return (length * breadth * height);
}
Cube1() {
length = 10;
breadth = 10;
height = 10;
}
Cube1(int l, int b, int h) {
length = l;
breadth = b;
height = h;
}
public static void main(String[]
args) {
Cube1 cubeObj1, cubeObj2;
cubeObj1 = new Cube1();
cubeObj2 = new Cube1(10, 20, 30);
System.out.println(”Volume of
Cube1 is : ” +
cubeObj1.getVolume());
System.out.println(”Volume of
Cube1 is : ” +
cubeObj2.getVolume());
}
Java2

More Related Content

What's hot

Java lec class, objects and constructors
Java lec class, objects and constructorsJava lec class, objects and constructors
Java lec class, objects and constructors
Jan Niño Acierto
 

What's hot (20)

[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP
 
Java lec class, objects and constructors
Java lec class, objects and constructorsJava lec class, objects and constructors
Java lec class, objects and constructors
 
Unit 3
Unit 3Unit 3
Unit 3
 
Java Methods
Java MethodsJava Methods
Java Methods
 
Java OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 3) - Class and ObjectJava OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 3) - Class and Object
 
L7 inheritance
L7 inheritanceL7 inheritance
L7 inheritance
 
Ch03
Ch03Ch03
Ch03
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
 
Java class,object,method introduction
Java class,object,method introductionJava class,object,method introduction
Java class,object,method introduction
 
Classes,object and methods java
Classes,object and methods javaClasses,object and methods java
Classes,object and methods java
 
Java OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - InheritanceJava OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - Inheritance
 
Chap01
Chap01Chap01
Chap01
 
6. static keyword
6. static keyword6. static keyword
6. static keyword
 
Unit3 inheritance
Unit3 inheritanceUnit3 inheritance
Unit3 inheritance
 
Static keyword ppt
Static keyword pptStatic keyword ppt
Static keyword ppt
 
Java static keyword
Java static keywordJava static keyword
Java static keyword
 
Java OO Revisited
Java OO RevisitedJava OO Revisited
Java OO Revisited
 
Object oriented programming With C#
Object oriented programming With C#Object oriented programming With C#
Object oriented programming With C#
 
Week9 Intro to classes and objects in Java
Week9 Intro to classes and objects in JavaWeek9 Intro to classes and objects in Java
Week9 Intro to classes and objects in Java
 
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
 

Similar to Java2

10 - Encapsulation(object oriented programming)- java . ppt
10 - Encapsulation(object oriented programming)- java . ppt10 - Encapsulation(object oriented programming)- java . ppt
10 - Encapsulation(object oriented programming)- java . ppt
VhlRddy
 

Similar to Java2 (20)

Java
JavaJava
Java
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptx
 
VB.net&OOP.pptx
VB.net&OOP.pptxVB.net&OOP.pptx
VB.net&OOP.pptx
 
unit 2 java.pptx
unit 2 java.pptxunit 2 java.pptx
unit 2 java.pptx
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.
 
Java 102 intro to object-oriented programming in java
Java 102   intro to object-oriented programming in javaJava 102   intro to object-oriented programming in java
Java 102 intro to object-oriented programming in java
 
Introduction to OOP with java
Introduction to OOP with javaIntroduction to OOP with java
Introduction to OOP with java
 
Net framework
Net frameworkNet framework
Net framework
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
10 - Encapsulation(object oriented programming)- java . ppt
10 - Encapsulation(object oriented programming)- java . ppt10 - Encapsulation(object oriented programming)- java . ppt
10 - Encapsulation(object oriented programming)- java . ppt
 
c++ Unit I.pptx
c++ Unit I.pptxc++ Unit I.pptx
c++ Unit I.pptx
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application Development
 
C++ training
C++ training C++ training
C++ training
 
UNIT - IIInew.pptx
UNIT - IIInew.pptxUNIT - IIInew.pptx
UNIT - IIInew.pptx
 
Oops concept on c#
Oops concept on c#Oops concept on c#
Oops concept on c#
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptx
 
c++ lecture 1
c++ lecture 1c++ lecture 1
c++ lecture 1
 
c++ introduction
c++ introductionc++ introduction
c++ introduction
 
c++ lecture 1
c++ lecture 1c++ lecture 1
c++ lecture 1
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Java2

  • 2. INTRODUCTION TO JAVA: • Java was originally developed by James Gosling at Sun Microsystems . • It was released in 1995. • Java applications are typically compiled to Bytecode that can run on any Java Virtual Machine. • The language derives much of its syntax from C and C++.
  • 3. WHAT IS JAVA? • Java is a computer programming language. • It is concurrent and written in the concept of Class and Object. • Purely Object oriented programming. • Platform independent.
  • 4. FEATURES OF JAVA: • Simple • Secure • Portable • Object oriented • Multithreaded • High performance • Dynamic • interpreted
  • 5. APPLICATIONS OF JAVA: • Java program can run on any PC or any operating system. • Simple and Standalone. • Mobile application. • Enterprise. • Web application
  • 6. HOW JAVA DIFFER FROM C++: JAVA PROGRAMMING C++ PROGRAMMING • Completely object oriented language. • partially object oriented language. • It is portable. • It is non portable. • Both compiler and interpreter are used. • Only compiler is used. • Pointer is not used in java. • Pointer is used in c++. • no global variable is present. • Global variable is present. • Operator overloading is not possible. • Operator overloading is possible. • Scope resolution operator is used. • Scope resolution operator is used.
  • 7. HOW JAVA DIFFER FROM C: JAVA PROGRAMMING C PROGRAMMING • Object oriented language. • Function oriented language. • It is built into long security. • It has limited security. • Allocating memory by memory function. • Allocation of memory by new function. • Memory address is through pointers. • Memory address is through reference.
  • 8. OBJECT ORIETNED PROGRAMMING CONCEPTS: • Object • Class • Data abstraction • Data encapsulation • Polymorphism • Inheritance • Dynamic binding • Message communication
  • 9. OBJECT: • Basic runtime entity. • Represent user defined datatype. • Object interact by sending messages to one another. CLASS: • Collection of similar objects. • User defined datatype. • Eg: Fruit.
  • 10. DATA ABSTRACTION: • The act of representing essential feautures without including the background details. • Insulation of the data from direct access by the program is called as data hiding. DATA ENCAPSULATION: • Wrapping up of data and methods into a single unit.
  • 11. INHERITANCE: • Objects of one class acquired the properties of objects of another class. • Supports the concepts of hierarchical classification. • Provides the idea of reusability. • Can add additional features to an existing class without modifying it.
  • 12. TYPES OF INHERITANCE: • Single inheritance • Multiple inheritance • Multilevel inheritance • Hierarchical inheritance • Hybrid inheritance.
  • 13. POLYMORPHISM: • Ability to take more than one form. • Exhibit different behaviour in different instances. • Single function name can be used to handle different number an different types of arguments. TYPES: • Dynamic polymorphism. • Static polymorphism.
  • 14. DYNAMIC BINDING: • The code assosiated with the given procedure call is not known until the time of the call at runtime. • Assosiated with the polymorphism an inheritance. • A procedure call associated with a polymorphic reference depends on the dynamic type of the reference.
  • 15. MESSAGE COMMUNICATION: • Program consists of a set of objects that communicate with each other. Involves the following basic steps: • creating classes that define objects and their behaviour . • creating objects from class definition. • establishing communications among objects.
  • 16. DEFINING THE CLASS: • Once the class type has been defined,we can create the variables. • Variables are termed as instances of classes. SYNTAX: class classname [extends superclassname] { fields declaration; method declaration; }
  • 17. METHODS: • Methods are declared inside the body of the class. • Methods that are necessary to manipulate the data contained in the class. SYNTAX: type methodname (parameter_list) { method_body; }
  • 18. METHOD DECLARATION: • The name of the methods(method name). • The type of the value the method returns(type). • A list of parameters(parameter_list). • The body of the method.
  • 19. public class Cse { public void show() { System.out.println("Sample Method "); } public static void main(String args[]) { Cse obj=new Cse1(); obj.show(); } } PROGRAM FOR METHOD DECLARATION:
  • 20. FINALIZER METHODS: • Java supports a concept called Finalization. • Java runtime is an automatic garbage collecting system. • Automatically frees up the memory resources used by the objects. SYNTAX protected void finalize() { … ... }
  • 21. ACCESS SPECIFIERS: • It is restrict the place where we are using the member of the class. • It is used to access the member. THREE TYPES: • private • protected • public
  • 22. STATIC: • Can be called without objects. • Initialization is not necessary. • Static function can access only the static variables. PROGRAM: class sample { public static void main(String[] args) { display(); } static void display() { System.out.println(“hai hello"); } }
  • 23. STATIC MEMBER: • The member that are declared static as shown above are static member. • Gets memory only in class area at the time of class loading. • Memory efficient. Types of static member: • static variable • static method • static block
  • 24. STATIC MEMBER: class math { Static float mul(float x.float y) { return x*y; } Static float div(float x,float y) { return x/y; } } class math { public void static main(string args[]) { float a=math.mul(4.0.5.0); float b=math.div(a,2.0); System.out.println(“b=“+b); } }
  • 25. STATIC VARIABLE • Gets memory only in class area at the time of class loading. • Memory efficient. Class Stu { int rollnumber; string name; Static string name=“ITS” Stu( int r.string n) { rollnumber=r; name=n; } Void display() { System.out.println(“+rollnumber+” ”+name+””+college+”); } Public Static void main (string args[]) { Stu s1=new stu(111,”karan”); Stu s1=new stu(222”priya”); S1.display(); S2.display(); }
  • 26. STATIC METHOD: • It belongs to the class rare than the object of the class . • Invoked without the need for creating a instance of class. • It can access static data member and can change value of it. class Calculate { Static int cube(int x); return x*x*x; }
  • 27. STATIC BLOCK:  It is used to initialize the static data member.  Executed before main method at the time of class loading. Program: class cse { Static { system.out.println(“static block is invoked”);} public static main(string args[]); }
  • 28. CONSTRUCTOR: • It is a special method where will invoke automatically when the time of object creation. Rules: • Constructor name and the class name should be same. • It wont have any return type. • It is used to assign the value to the instance variable. • It can be with parameter or without parameter..
  • 29. PROGRAM FOR CONSTRUCTORS: public class Cube1 { int length; int breadth; int height; public int getVolume() { return (length * breadth * height); } Cube1() { length = 10; breadth = 10; height = 10; } Cube1(int l, int b, int h) { length = l; breadth = b; height = h; } public static void main(String[] args) { Cube1 cubeObj1, cubeObj2; cubeObj1 = new Cube1(); cubeObj2 = new Cube1(10, 20, 30); System.out.println(”Volume of Cube1 is : ” + cubeObj1.getVolume()); System.out.println(”Volume of Cube1 is : ” + cubeObj2.getVolume()); }