SlideShare a Scribd company logo
JAVA AND OOPS
CONCEPTS
(SUB CODE: CSE-S204)
NAME: PRIYANSHU GUPTA
ROLL NO: 055
BRANCH: CSE
INTRODUCTION AND KEY FEATURES:
(1.)Java is a high-level, class-based, object-oriented programming language.
(2.) Design goal of allowing application developers to "write once, run anywhere" (WORA),
meaning compiled Java code can run on all platforms that support Java without the need for
recompilation.
FEATURES:
. Platform Independent
. Object- Oriented
. Performance: Just –In Time Compilation
. Garbage Collection
Java Virtual Machine (JVM)
 The JVM is an integral part of the Java programming ecosystem , serving as a
virtual platform that executes Java bytecode. This bytecode is a form of
intermediate representation of Java programs , which is generated after compiling
java source code.
 The JVM enables Java programs to run on implementation , thereby providing
Java with its hallmark feature of ‘ write once, run anywhere.’
 Its abstracts away the complexities of the underlying hardware and operating
systems, managing memory allocation, garbage collection, and proving a secure
execution environment, making it easier for developers to build portable and
efficient Java applications without worrying about platform – specific details.
JAVA RUNTIME ENVIRONMENT (JRE)
 The Java Runtime Environment (JRE) is a part of the Java Development Kit (JDK)
that provides the libraries , the Java Virtual Machine(JVM), and other components
necessary for running applications written in Java programming language.
 It acts as a runtime platform, ensuring that Java applications can execute on any
device with the JRE installed, regardless of the underlying hardware and operating
system. This makes Java applications portable and cross-platform meaning they
can run on any device that has the JRE installed.
Java Development Kit (JDK)
 The JDK is a comprehensive toolkit for developers who want to develop Java
applications. It includes the JRE , which provides the libraries and the JVM , as well
as the wide array of development tools such as compiler , documentation
generator and more. The JDK enables developers to write , compile and debug
Java code and build applications .
 It serves as a foundation for Java development allowing for the creation of robust,
high performance Java applications that can run on any platform with a
compatible JVM.
Java Keywords
Variables :
 Variables are the named storage locations.
DATATYPES IN JAVA:
OPERATORS IN JAVA:
 Arithmetic Operator (+ ,- ,* ,/ ,%)
 Relational Operator (> , < , >= , <= , == , != )
 Logical Operator (&& , || , ! )
 Bitwise Operator ( & , | , ^ , << , >> )
 Assignment Operator ( = , += , -= , *= , /= , %= )
 Unary Increment / Decrement Operator (++ , -- )
Taking Input In Java:
Java Garbage Collector :
 The Java Garbage Collector (GC) is an automatic memory management system
the frees up the memory by reclaiming space occupied by the objects that are no
longer in use by a program.
 In Java , objects are dynamically allocated on the heap, and over time, some
objects may no longer be reachable or needed by the application.
 The garbage collector identifies these “garbage” objects and deletes them to
make room for new objects , thus preventing memory leaks and ensuring efficient
use of memory.
Java Conditionals:
 If statement
 If – else statement
 Ternary Operator
 Nested If – else statement
 If - else if – else ladder
 Switch Statement
Loops In Java:
 For Loop:
 While Loop:
 Do – while Loop:
 For – each Loop
Methods In Java :
 A method is a block of code that performs a specific task.
 Function Declaration:
 Function Call :
Return Keyword and Method Parameters:
 Return Keyword:
 Method Parameter:
Arrays In Java :
 In Java , an array is a container object that holds a fixed number of values of a
single type . The length of an array is established when the array is created , and
it cannot be changed once created . Each item in an array is called an element ,
and each element is accessed by its numerical index.
 Creation of array:
 Declaration
 Allocation
 Initialization
For – each Loop:
Multi – Dimensional Array:
 In Java , a multi – dimensional array is essentially an array of arrays. The most
common type of multi – dimensional array is the two – dimensional array , which
can be thought of as grid or table of rows and columns . However , java supports
arrays of any number of dimensions.
Strings in Java :
 In Java , a string is a sequence of characters used to store and manipulates text. It
is one of the most fundamental data types in Java and is part of java . lang
package, which is automatically imported into every Java program.
 Creation of String :
 String Keyword: string str = “Priyanshu” ;
 New Keyword : String name = new String (“Priyanshu”);
 Strings in Java are immutable , which means once a string object is created , its
value cannot be changed. If you perform any operations that seem to modify a
String , what actually happens is a new string object is created .
String Pool and Java String Methods:
 String Pool: Java maintains a special area in the Java heap called the string
pool. This is where all string literals are stored . When you create a string using
string literals , Java checks the pool first . If it already exists , it returns the
reference to the same instance , helping to save memory.
 Java String Methods:
 .length( )
 .charAt ( int index )
 .substring( int beginIndex , int endIndex )
 .contains( CharSequence s )
Java Exception Handling:
 In Java , exception is an unwanted or unexpected event , which occurs during the
execution of a program , i.e, at runtime, that disrupts the normal flow of
program’s instructions. Exceptions can be caught and handles by the program.
 Exception occurs due to:
 Invalid user input
 Device failure
 Code errors
 Opening an unavailable file
 Loss of network connection
Runtime Exceptions and IO Exception:
Try – Catch Block:
 The try statement allows you to define a block of code to be tested for errors
while it is being executed.
 The catch statement allows you to define a block of code to be executed , if an
error occurs in the try block.
Try – catch – finally Block:
Throws Keyword:
 We use the throws keyword in the method declaration to declare the type of
exceptions that might occur within it .
 Its syntax is :
Throw Keyword:
 The throw keyword is used to explicitly throw a single exception. When an
exception is thrown , the flow of program execution transfers from the try block
to the catch block . We use the throw keyword within a method.
 Its syntax is :
OOPS:
Encapsulation:
Inheritance:
JAVA AND OOPS CONCEPTS.pptx helpful for engineering
Types Of Inheritance:
Polymorphism:
Static Polymorphism:
 Method Overloading
 Operator Overloading
Abstract Class vs Interface:
Thank YOU…

More Related Content

Similar to JAVA AND OOPS CONCEPTS.pptx helpful for engineering (20)

PPTX
Java programing language unit 1 introduction
chnrketan
 
PPT
What is Java Technology (An introduction with comparision of .net coding)
Shaharyar khan
 
PPTX
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
tusharjain613841
 
PPTX
java slides
RizwanTariq18
 
PDF
Introduction java programming
Nanthini Kempaiyan
 
PPTX
brief introduction to core java programming.pptx
ansariparveen06
 
PPTX
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
PPT
java-corporate-training-institute-in-mumbai
Unmesh Baile
 
PPT
java-corporate-training-institute-in-mumbai
vibrantuser
 
PPTX
object oriented programming unit one ppt
isiagnel2
 
PPT
INTRODUCTION TO JAVA
Pintu Dasaundhi (Rahul)
 
PPTX
History of java'
deepthisujithra
 
PPTX
Core java
Mallikarjuna G D
 
PPTX
Core Java Tutorials by Mahika Tutorials
Mahika Tutorials
 
PPT
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 
PPT
Java Simple Introduction in single course
binzbinz3
 
PDF
Bt0074 oops with java
Techglyphs
 
PPTX
Java Notes
Sreedhar Chowdam
 
PPTX
Java Notes by C. Sreedhar, GPREC
Sreedhar Chowdam
 
PDF
Introduction to JAVA
Professional Guru
 
Java programing language unit 1 introduction
chnrketan
 
What is Java Technology (An introduction with comparision of .net coding)
Shaharyar khan
 
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
tusharjain613841
 
java slides
RizwanTariq18
 
Introduction java programming
Nanthini Kempaiyan
 
brief introduction to core java programming.pptx
ansariparveen06
 
Java programmingjsjdjdjdjdjdjdjdjdiidiei
rajputtejaswa12
 
java-corporate-training-institute-in-mumbai
Unmesh Baile
 
java-corporate-training-institute-in-mumbai
vibrantuser
 
object oriented programming unit one ppt
isiagnel2
 
INTRODUCTION TO JAVA
Pintu Dasaundhi (Rahul)
 
History of java'
deepthisujithra
 
Core java
Mallikarjuna G D
 
Core Java Tutorials by Mahika Tutorials
Mahika Tutorials
 
java01.pptbvuyvyuvvvvvvvvvvvvvvvvvvvvyft
nagendrareddy104104
 
Java Simple Introduction in single course
binzbinz3
 
Bt0074 oops with java
Techglyphs
 
Java Notes
Sreedhar Chowdam
 
Java Notes by C. Sreedhar, GPREC
Sreedhar Chowdam
 
Introduction to JAVA
Professional Guru
 

Recently uploaded (20)

PPTX
Water Resources Engineering (CVE 728)--Slide 4.pptx
mohammedado3
 
PDF
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PPTX
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PPTX
澳洲电子毕业证澳大利亚圣母大学水印成绩单UNDA学生证网上可查学历
Taqyea
 
PDF
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
PPTX
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
 
PPTX
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
PPT
New_school_Engineering_presentation_011707.ppt
VinayKumar304579
 
PPTX
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
PPTX
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PPT
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
PDF
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
PDF
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
Water Resources Engineering (CVE 728)--Slide 4.pptx
mohammedado3
 
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
Design Thinking basics for Engineers.pdf
CMR University
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
澳洲电子毕业证澳大利亚圣母大学水印成绩单UNDA学生证网上可查学历
Taqyea
 
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
 
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
New_school_Engineering_presentation_011707.ppt
VinayKumar304579
 
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
Ad

JAVA AND OOPS CONCEPTS.pptx helpful for engineering

  • 1. JAVA AND OOPS CONCEPTS (SUB CODE: CSE-S204) NAME: PRIYANSHU GUPTA ROLL NO: 055 BRANCH: CSE
  • 2. INTRODUCTION AND KEY FEATURES: (1.)Java is a high-level, class-based, object-oriented programming language. (2.) Design goal of allowing application developers to "write once, run anywhere" (WORA), meaning compiled Java code can run on all platforms that support Java without the need for recompilation. FEATURES: . Platform Independent . Object- Oriented . Performance: Just –In Time Compilation . Garbage Collection
  • 3. Java Virtual Machine (JVM)  The JVM is an integral part of the Java programming ecosystem , serving as a virtual platform that executes Java bytecode. This bytecode is a form of intermediate representation of Java programs , which is generated after compiling java source code.  The JVM enables Java programs to run on implementation , thereby providing Java with its hallmark feature of ‘ write once, run anywhere.’  Its abstracts away the complexities of the underlying hardware and operating systems, managing memory allocation, garbage collection, and proving a secure execution environment, making it easier for developers to build portable and efficient Java applications without worrying about platform – specific details.
  • 4. JAVA RUNTIME ENVIRONMENT (JRE)  The Java Runtime Environment (JRE) is a part of the Java Development Kit (JDK) that provides the libraries , the Java Virtual Machine(JVM), and other components necessary for running applications written in Java programming language.  It acts as a runtime platform, ensuring that Java applications can execute on any device with the JRE installed, regardless of the underlying hardware and operating system. This makes Java applications portable and cross-platform meaning they can run on any device that has the JRE installed.
  • 5. Java Development Kit (JDK)  The JDK is a comprehensive toolkit for developers who want to develop Java applications. It includes the JRE , which provides the libraries and the JVM , as well as the wide array of development tools such as compiler , documentation generator and more. The JDK enables developers to write , compile and debug Java code and build applications .  It serves as a foundation for Java development allowing for the creation of robust, high performance Java applications that can run on any platform with a compatible JVM.
  • 7. Variables :  Variables are the named storage locations.
  • 9. OPERATORS IN JAVA:  Arithmetic Operator (+ ,- ,* ,/ ,%)  Relational Operator (> , < , >= , <= , == , != )  Logical Operator (&& , || , ! )  Bitwise Operator ( & , | , ^ , << , >> )  Assignment Operator ( = , += , -= , *= , /= , %= )  Unary Increment / Decrement Operator (++ , -- )
  • 11. Java Garbage Collector :  The Java Garbage Collector (GC) is an automatic memory management system the frees up the memory by reclaiming space occupied by the objects that are no longer in use by a program.  In Java , objects are dynamically allocated on the heap, and over time, some objects may no longer be reachable or needed by the application.  The garbage collector identifies these “garbage” objects and deletes them to make room for new objects , thus preventing memory leaks and ensuring efficient use of memory.
  • 12. Java Conditionals:  If statement  If – else statement  Ternary Operator  Nested If – else statement  If - else if – else ladder  Switch Statement
  • 13. Loops In Java:  For Loop:  While Loop:  Do – while Loop:  For – each Loop
  • 14. Methods In Java :  A method is a block of code that performs a specific task.  Function Declaration:  Function Call :
  • 15. Return Keyword and Method Parameters:  Return Keyword:  Method Parameter:
  • 16. Arrays In Java :  In Java , an array is a container object that holds a fixed number of values of a single type . The length of an array is established when the array is created , and it cannot be changed once created . Each item in an array is called an element , and each element is accessed by its numerical index.  Creation of array:  Declaration  Allocation  Initialization
  • 17. For – each Loop:
  • 18. Multi – Dimensional Array:  In Java , a multi – dimensional array is essentially an array of arrays. The most common type of multi – dimensional array is the two – dimensional array , which can be thought of as grid or table of rows and columns . However , java supports arrays of any number of dimensions.
  • 19. Strings in Java :  In Java , a string is a sequence of characters used to store and manipulates text. It is one of the most fundamental data types in Java and is part of java . lang package, which is automatically imported into every Java program.  Creation of String :  String Keyword: string str = “Priyanshu” ;  New Keyword : String name = new String (“Priyanshu”);  Strings in Java are immutable , which means once a string object is created , its value cannot be changed. If you perform any operations that seem to modify a String , what actually happens is a new string object is created .
  • 20. String Pool and Java String Methods:  String Pool: Java maintains a special area in the Java heap called the string pool. This is where all string literals are stored . When you create a string using string literals , Java checks the pool first . If it already exists , it returns the reference to the same instance , helping to save memory.  Java String Methods:  .length( )  .charAt ( int index )  .substring( int beginIndex , int endIndex )  .contains( CharSequence s )
  • 21. Java Exception Handling:  In Java , exception is an unwanted or unexpected event , which occurs during the execution of a program , i.e, at runtime, that disrupts the normal flow of program’s instructions. Exceptions can be caught and handles by the program.  Exception occurs due to:  Invalid user input  Device failure  Code errors  Opening an unavailable file  Loss of network connection
  • 22. Runtime Exceptions and IO Exception:
  • 23. Try – Catch Block:  The try statement allows you to define a block of code to be tested for errors while it is being executed.  The catch statement allows you to define a block of code to be executed , if an error occurs in the try block.
  • 24. Try – catch – finally Block:
  • 25. Throws Keyword:  We use the throws keyword in the method declaration to declare the type of exceptions that might occur within it .  Its syntax is :
  • 26. Throw Keyword:  The throw keyword is used to explicitly throw a single exception. When an exception is thrown , the flow of program execution transfers from the try block to the catch block . We use the throw keyword within a method.  Its syntax is :
  • 27. OOPS:
  • 33. Static Polymorphism:  Method Overloading  Operator Overloading
  • 34. Abstract Class vs Interface: