SlideShare a Scribd company logo
1 of 35
Download to read offline
INTRODUCTION TO JAVA
WHAT IS JAVA?
• Java is an object oriented programming language.
• Java is platform independent.
• Java is used in mobile phones and other embedded devices.
HISTORY OF JAVA
• Java was developed by James Gosling from sun microsystems in the
year 1995.
• In January 1996, JDK1.0 was released in the name of OAK.
• The JDK 1.0.2 was the first stable version.
• James Gosling, Mike Sheridan and Patrick Naughton initiated the
green project in June 1991.
Versions of java
Features of java
• Simple
• Secure
• Portable
• Object-Oriented
• Robust
• Multithreaded
• Architecture neutral
• Interpreted
• High Performance
• Distributed
• Dynamic
Types of SDK’s in java
• Java SE
• Java EE
• Java ME
• Java Embedded
• Java DB
• Web Tier
• Java Card
• Java TV
Java virtual machine
• Java Virtual Machine is used for converting the bytecode into the
machine understandable format.
• JVM provides an abstraction between the java program and the
operating system.
• Key components in JVM are
• Class loader
• Bytecode verifier
• Just In Time (JIT) compiler
How java program is executed?
How to compile and run java program
• The java program should be saved with an extension “.java”
• The command to compile the java program is “javac name.java ”
• The command to run the java program is “java name”
Sample Java program – Hello World
Main Concepts of OOP
• Encapsulation
• Inheritance
• Polymorphism
• Abstraction
Encapsulation
• Encapsulation is the technique of making the fields in a class private
and providing access to the fields via public methods.
• The main benefit of encapsulation is the ability to modify our
implemented code without breaking the code of others who use our
code.
• Encapsulation gives maintainability, flexibility and extensibility to our
code.
Access Specifiers in java
• public
• private
• protected
• Default
Public access specifier
• A class, method, constructor, interface etc., declared public can be
accessed from any other class.
• Therefore fields, methods, blocks declared inside a public class can be
accessed from any class belonging to the Java Universe.
• If the public class we are trying to access is in a different package,
then the public class still need to be imported.
Private access specifiers
• Methods, Variables and Constructors that are declared private can
only be accessed within the declared class itself.
• Private access modifier is the most restrictive access level. Class and
interfaces cannot be private.
• Variables that are declared private can be accessed outside the class if
public getter methods are present in the class.
• Using the private modifier is the main way that an object
encapsulates itself and hide data from the outside world.
Sample code for private access specifier
Protected access specifier
• Variables, methods and constructors which are declared protected in
a superclass can be accessed only by the subclasses in other package
or any class within the package of the protected members' class.
• The protected access modifier cannot be applied to class and
interfaces. Methods, fields can be declared protected, however
methods and fields in a interface cannot be declared protected.
Sample code for protected access specifier
Default specifier
• The default specifier is used to make a class visible to all the other
classes in its package but not visible to classes from other packages
Inheritance
• Inheritance is a compile-time mechanism in Java that allows you to
extend a class with another class
• The keyword extends is used for inheriting a Class.
• The class which extends some other class is called as derived class
• The base class is called as the super class or parent class.
Types of inheritance
• Simple inheritance
• Multilevel inheritance
• Hierarchical inheritance
• Hybrid inheritance
Simple inheritance
• There are only 1 base class and 1 derived class
• Syntax:
Class Parentclass
{
}
Class Dclass extendsParentclass
{
}
Simple inheritance sample code and output
Multilevel inheritance
• It contains derived classes which are in turn base class to another class.
class Base
{
}
class Derived1 extends Base
{
}
class Derived2 extends Derived1
{
}
Multilevel inheritance sample code and
output
Hierarchical inheritance
• It contains one base class and more than one derived class.
class Base
{
}
class Derived1 extends Base
{
}
class Derived2 extends Base{ }
Sample code and output for Hierarchical
inheritance
Hybrid inheritance
• It is a combination of any two or more inheritances.
Sample code for hybrid inheritance
Interface
• An interface in Java is similar to a class, but the body of an interface
can include only abstract methods and final fields (constants).
• A class implements an interface by providing code for each method
declared by the interface.
• The keyword used in interface concepts are interface and implements
Syntax for interface
interface interfacename
{
method_declaration();
}
class A implements interfacename
{
method_declaration(){ }
}
Interface sample code
Interface sample output
Any queries??
Thank you 

More Related Content

What's hot

Core Java Introduction | Basics
Core Java Introduction  | BasicsCore Java Introduction  | Basics
Core Java Introduction | BasicsHùng Nguyễn Huy
 
02 introductionto java
02 introductionto java02 introductionto java
02 introductionto javaAPU
 
Introduction to Java Programming
Introduction to Java Programming Introduction to Java Programming
Introduction to Java Programming Saravanakumar R
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NETSabith Byari
 
OCA JAVA - 1 Packages and Class Structure
 OCA JAVA - 1 Packages and Class Structure OCA JAVA - 1 Packages and Class Structure
OCA JAVA - 1 Packages and Class StructureFernando Gil
 
Review Session and Attending Java Interviews
Review Session and Attending Java Interviews Review Session and Attending Java Interviews
Review Session and Attending Java Interviews Hitesh-Java
 
Introduction to Java Part-3
Introduction to Java Part-3Introduction to Java Part-3
Introduction to Java Part-3RatnaJava
 
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...Sagar Verma
 
A begineers guide of JAVA - Getting Started
 A begineers guide of JAVA - Getting Started A begineers guide of JAVA - Getting Started
A begineers guide of JAVA - Getting StartedRakesh Madugula
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java ProgrammingRavi Kant Sahu
 
Class notes(week 7) on packages
Class notes(week 7) on packagesClass notes(week 7) on packages
Class notes(week 7) on packagesKuntal Bhowmick
 
Java introduction
Java introductionJava introduction
Java introductionSagar Verma
 

What's hot (20)

Dacj 2-1 a
Dacj 2-1 aDacj 2-1 a
Dacj 2-1 a
 
Core Java Introduction | Basics
Core Java Introduction  | BasicsCore Java Introduction  | Basics
Core Java Introduction | Basics
 
Ch5 inheritance
Ch5 inheritanceCh5 inheritance
Ch5 inheritance
 
Java programming
Java programmingJava programming
Java programming
 
02 introductionto java
02 introductionto java02 introductionto java
02 introductionto java
 
Introduction to Java Programming
Introduction to Java Programming Introduction to Java Programming
Introduction to Java Programming
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NET
 
Packages in java
Packages in javaPackages in java
Packages in java
 
OCA JAVA - 1 Packages and Class Structure
 OCA JAVA - 1 Packages and Class Structure OCA JAVA - 1 Packages and Class Structure
OCA JAVA - 1 Packages and Class Structure
 
Java Starting
Java StartingJava Starting
Java Starting
 
1
11
1
 
Review Session and Attending Java Interviews
Review Session and Attending Java Interviews Review Session and Attending Java Interviews
Review Session and Attending Java Interviews
 
Introduction to Java Part-3
Introduction to Java Part-3Introduction to Java Part-3
Introduction to Java Part-3
 
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
 
Introduction To Java.
Introduction To Java.Introduction To Java.
Introduction To Java.
 
A begineers guide of JAVA - Getting Started
 A begineers guide of JAVA - Getting Started A begineers guide of JAVA - Getting Started
A begineers guide of JAVA - Getting Started
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Class notes(week 7) on packages
Class notes(week 7) on packagesClass notes(week 7) on packages
Class notes(week 7) on packages
 
Java introduction
Java introductionJava introduction
Java introduction
 

Similar to Java introduction

Java OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsJava OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsRaja Sekhar
 
Skillwise Elementary Java Programming
Skillwise Elementary Java ProgrammingSkillwise Elementary Java Programming
Skillwise Elementary Java ProgrammingSkillwise Group
 
GETTING STARTED WITH JAVA(beginner)
GETTING STARTED WITH JAVA(beginner)GETTING STARTED WITH JAVA(beginner)
GETTING STARTED WITH JAVA(beginner)HarshithaAllu
 
JAVA PROGRAMMING- OOP Concept
JAVA PROGRAMMING- OOP ConceptJAVA PROGRAMMING- OOP Concept
JAVA PROGRAMMING- OOP ConceptTrinity Dwarka
 
U1 JAVA.pptx
U1 JAVA.pptxU1 JAVA.pptx
U1 JAVA.pptxmadan r
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to JavaSoumya Suman
 
intro_java (1).pptx
intro_java (1).pptxintro_java (1).pptx
intro_java (1).pptxSmitNikumbh
 
OOP with Java
OOP with JavaOOP with Java
OOP with JavaOmegaHub
 
JAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptJAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptAliyaJav
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 
Learn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat ShahriyarLearn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat ShahriyarAbir Mohammad
 

Similar to Java introduction (20)

Java OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsJava OOP s concepts and buzzwords
Java OOP s concepts and buzzwords
 
Skillwise Elementary Java Programming
Skillwise Elementary Java ProgrammingSkillwise Elementary Java Programming
Skillwise Elementary Java Programming
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
GETTING STARTED WITH JAVA(beginner)
GETTING STARTED WITH JAVA(beginner)GETTING STARTED WITH JAVA(beginner)
GETTING STARTED WITH JAVA(beginner)
 
JAVA PROGRAMMING- OOP Concept
JAVA PROGRAMMING- OOP ConceptJAVA PROGRAMMING- OOP Concept
JAVA PROGRAMMING- OOP Concept
 
U1 JAVA.pptx
U1 JAVA.pptxU1 JAVA.pptx
U1 JAVA.pptx
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
 
L1 basics
L1 basicsL1 basics
L1 basics
 
27c
27c27c
27c
 
27csharp
27csharp27csharp
27csharp
 
intro_java (1).pptx
intro_java (1).pptxintro_java (1).pptx
intro_java (1).pptx
 
OOP with Java
OOP with JavaOOP with Java
OOP with Java
 
PPT Lecture-1.4.pptx
PPT Lecture-1.4.pptxPPT Lecture-1.4.pptx
PPT Lecture-1.4.pptx
 
JAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptJAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).ppt
 
JAVA PROGRAMMING
JAVA PROGRAMMINGJAVA PROGRAMMING
JAVA PROGRAMMING
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
Learn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat ShahriyarLearn Java with Dr. Rifat Shahriyar
Learn Java with Dr. Rifat Shahriyar
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
 

More from Muthukumaran Subramanian (19)

Struts introduction
Struts introductionStruts introduction
Struts introduction
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Threads concept in java
Threads concept in javaThreads concept in java
Threads concept in java
 
StringTokenizer in java
StringTokenizer in javaStringTokenizer in java
StringTokenizer in java
 
Overriding methods
Overriding methodsOverriding methods
Overriding methods
 
Non access modifiers
Non access modifiersNon access modifiers
Non access modifiers
 
Jdbc connectivity in java
Jdbc connectivity in javaJdbc connectivity in java
Jdbc connectivity in java
 
Garbage collection in java
Garbage collection in javaGarbage collection in java
Garbage collection in java
 
Files in java
Files in javaFiles in java
Files in java
 
Exception handling
Exception handlingException handling
Exception handling
 
Date class
Date classDate class
Date class
 
Currency class
Currency classCurrency class
Currency class
 
Timer class in java
Timer class in javaTimer class in java
Timer class in java
 
Calendar class in java
Calendar class in javaCalendar class in java
Calendar class in java
 
Classes and objects in java
Classes and objects in javaClasses and objects in java
Classes and objects in java
 
intorduction to Arrays in java
intorduction to Arrays in javaintorduction to Arrays in java
intorduction to Arrays in java
 
Access modifiers in java
Access modifiers in javaAccess modifiers in java
Access modifiers in java
 
Abstract classes
Abstract classesAbstract classes
Abstract classes
 
Collections and generics
Collections and genericsCollections and generics
Collections and generics
 

Recently uploaded

Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
 

Recently uploaded (20)

(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 

Java introduction

  • 2. WHAT IS JAVA? • Java is an object oriented programming language. • Java is platform independent. • Java is used in mobile phones and other embedded devices.
  • 3. HISTORY OF JAVA • Java was developed by James Gosling from sun microsystems in the year 1995. • In January 1996, JDK1.0 was released in the name of OAK. • The JDK 1.0.2 was the first stable version. • James Gosling, Mike Sheridan and Patrick Naughton initiated the green project in June 1991.
  • 5. Features of java • Simple • Secure • Portable • Object-Oriented • Robust • Multithreaded • Architecture neutral • Interpreted • High Performance • Distributed • Dynamic
  • 6. Types of SDK’s in java • Java SE • Java EE • Java ME • Java Embedded • Java DB • Web Tier • Java Card • Java TV
  • 7. Java virtual machine • Java Virtual Machine is used for converting the bytecode into the machine understandable format. • JVM provides an abstraction between the java program and the operating system. • Key components in JVM are • Class loader • Bytecode verifier • Just In Time (JIT) compiler
  • 8. How java program is executed?
  • 9. How to compile and run java program • The java program should be saved with an extension “.java” • The command to compile the java program is “javac name.java ” • The command to run the java program is “java name”
  • 10. Sample Java program – Hello World
  • 11. Main Concepts of OOP • Encapsulation • Inheritance • Polymorphism • Abstraction
  • 12. Encapsulation • Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. • The main benefit of encapsulation is the ability to modify our implemented code without breaking the code of others who use our code. • Encapsulation gives maintainability, flexibility and extensibility to our code.
  • 13. Access Specifiers in java • public • private • protected • Default
  • 14. Public access specifier • A class, method, constructor, interface etc., declared public can be accessed from any other class. • Therefore fields, methods, blocks declared inside a public class can be accessed from any class belonging to the Java Universe. • If the public class we are trying to access is in a different package, then the public class still need to be imported.
  • 15. Private access specifiers • Methods, Variables and Constructors that are declared private can only be accessed within the declared class itself. • Private access modifier is the most restrictive access level. Class and interfaces cannot be private. • Variables that are declared private can be accessed outside the class if public getter methods are present in the class. • Using the private modifier is the main way that an object encapsulates itself and hide data from the outside world.
  • 16. Sample code for private access specifier
  • 17. Protected access specifier • Variables, methods and constructors which are declared protected in a superclass can be accessed only by the subclasses in other package or any class within the package of the protected members' class. • The protected access modifier cannot be applied to class and interfaces. Methods, fields can be declared protected, however methods and fields in a interface cannot be declared protected.
  • 18. Sample code for protected access specifier
  • 19. Default specifier • The default specifier is used to make a class visible to all the other classes in its package but not visible to classes from other packages
  • 20. Inheritance • Inheritance is a compile-time mechanism in Java that allows you to extend a class with another class • The keyword extends is used for inheriting a Class. • The class which extends some other class is called as derived class • The base class is called as the super class or parent class.
  • 21. Types of inheritance • Simple inheritance • Multilevel inheritance • Hierarchical inheritance • Hybrid inheritance
  • 22. Simple inheritance • There are only 1 base class and 1 derived class • Syntax: Class Parentclass { } Class Dclass extendsParentclass { }
  • 23. Simple inheritance sample code and output
  • 24. Multilevel inheritance • It contains derived classes which are in turn base class to another class. class Base { } class Derived1 extends Base { } class Derived2 extends Derived1 { }
  • 25. Multilevel inheritance sample code and output
  • 26. Hierarchical inheritance • It contains one base class and more than one derived class. class Base { } class Derived1 extends Base { } class Derived2 extends Base{ }
  • 27. Sample code and output for Hierarchical inheritance
  • 28. Hybrid inheritance • It is a combination of any two or more inheritances.
  • 29. Sample code for hybrid inheritance
  • 30. Interface • An interface in Java is similar to a class, but the body of an interface can include only abstract methods and final fields (constants). • A class implements an interface by providing code for each method declared by the interface. • The keyword used in interface concepts are interface and implements
  • 31. Syntax for interface interface interfacename { method_declaration(); } class A implements interfacename { method_declaration(){ } }