SlideShare a Scribd company logo
UNIT 1
FUNDAMENTALS OF OBJECT-
ORIENTED PROGRAMMING
Basic Concepts Of Object Oriented Programming
And Java Environment
By
Hannah Roseline
Assistant Professor
Introduction To Object Oriented Programming:
 Object-oriented programming (OOP) is a programming paradigm using
"objects" – data structures consisting of data fields and methods together
with their interactions – to design applications and computer programs.
 Programming techniques may include features such as data abstraction,
encapsulation, messaging, modularity, polymorphism, and inheritance.
Many modern programming languages now support OOP.
 OOP Which form the heart of java Language.
Definition of OOP:
Object- oriented programming is an approach that provides a way of
modularizing program by creating partitioned memory area for both data and
function that can be used as templates for creating copies of such modules
On demand.
Programming Paradigm :
A programming paradigm is a fundamental style of computer programming.
Paradigms differ in the concepts and abstractions used to represent the
elements of a program (such as objects, functions, variables, constraints, etc.)
and the steps that compose a computation (assignment, evaluation,
continuations, data flows, etc.).
The combination of data and method make up an object.
Basic Concept Of OOP:
Object:
Objects are the basic runtime entities in an object oriented system. They
may represent a person, a place, a bank account, a table of data or any
item that the program has to handle.
An object is an instance of class that allows programmes to use variable and
method inside the class
Object:
• Object is an run time entity.
• Is an Instance of class
• Represents a Place ,Person ,anything that have some attributes.
Class:
• Object contains data, and code to manipulate that
data. The entire set of data and code of an object
can be made a user- defined data type with the
help of a class
• A class is a blueprint or template for declaring and
creating object.
• A Class is a 3-Compartment Box encapsulating Data
and Functions
• Class name (or identifier): identifies the class.
• Data Members or Variables (or attributes, states,
fields): contains the static attributes of the class.
• Member Functions (or methods, behaviours,
operations):
Contains the dynamic operations of the class.
Data Encapsulation:
The wrapping up of data and functions into a single unit is known as
encapsulation.
The data is not accessible to the
outside world, only those function which are wrapped in the
can access it.
These functions provide the interface between the object’s data and
the program.
This insulation of the data from direct access by the program is
called data hiding or information hiding.
Data Abstraction
 Abstraction refers to the act of representing essential features
without including the background details or explanations.
 Since classes use the concept of data abstraction, they are known
as abstract data types (adt)
Data Encapsulation And Abstraction:
• Data encapsulation, sometimes referred to as data hiding.
• Data Encapsulation and Data Abstraction is one of the most
striking feature of object oriented programming.
• The wrapping up of data and code into a single unit is called
data encapsulation. The data is not accessible to the outside
world only those functions which are wrapped into a class can
only access the private data of the class.
Inheritance :
• Inheritance is one of the most striking feature of object oriented
programming.
• Inheritance is the process by which one class can acquire the
properties of another class.
• The new classes, known as subclasses (or derived classes), inherit
attributes and behavior of the pre-existing classes, which are referred
to as superclasses (or ancestor classes). The inheritance relationships
of classes gives rise to a hierarchy
• Inheritance is the process by which objects of one class acquire
the properties of objects of another class
• In OOP, the concept of inheritance provides the idea of reusability.
This means we can add additional features to an existing class
without modifying it.
Unit 1- Basic concept of object-oriented-programming.ppt
• A superclass, base class, or parent class is a class from which other
classes are derived. The classes that are derived from a super class
are known as child classes, derived classes, or subclasses.
• In object-oriented programming (OOP), inheritance is a way to
compartmentalize and reuse code by creating collections of
attributes and behaviors called objects which can be based on
previously created objects.
Polymorphism:
 Polymorphism, a Greek term means to ability to take more than
one form.
 An operation may exhibits different behaviors in different
instances. The behavior depends upon the type of data used in the
operation.
 For example consider the operation of addition for two numbers;
the operation will generate a sum. If the operands are string then
the operation would produce a third string by concatenation.
 The process of making an operator to exhibit different behavior in
different instances is known operator overloading
BenefitsOf OOP
OOP offers several benefits to both the program designer & the user
Through inheritance, we can eliminate redundant code and extend the
use of existing class
We can build programs from the standard working module the
communicate with one another, rather than having to start writing code
from scratch. This leads to saving of development time & higher
productivity.
The principle of data hiding helps the programmer to build & secure
programs that cannot be invaded by code in other parts of the program.
It is possible to map objects in the problem domain to those in the
program
It is easy to partition the work in a project based on objects
The data-centered design approach enables us to capture more details
of a model in implementable form.
•.
 Object-oriented systems can be easily upgraded from small to
large systems.
 Message passing techniques for communication between objects
makes the interface descriptions with external systems much
simpler.
 Software complexity can be easily managed .
 While it is possible to incorporate all these features in an object-
oriented system, their importance depends on the type of the
project and the preference of the programmer. There are a number
of issues that need to be tackled to reap some of the benefits stated
above. For instance, object libraries must be available for reuse.
The technology is still developing and current products may
be superseded quickly. Strict controls and protocols need to be
compromised
Application of OOP:
• Real-business systems are often much more complex and
contain many more objects with complicated attributes and
methods. OOP is useful in these types of applications because
it can simplify a complex problem. The promising areas for
application of OOP include:
 Real-time systems
 Simulation and modeling
 Object-oriented databases
 Hypertext, hypermedia and expertext
 Al and expert systems
 Neural networks and parallel programming
 Decision support and office automation systems
 CIM/CAM/CAD systems(computer Aided
manufacturing)(computer aided design).
About java:
• Java is a widely-used programming language for coding
web applications. It has been a popular choice among
developers for over two decades, with millions of Java
applications in use today. Java is a multi-platform, object-
oriented, and network-centric language that can be used as
a platform in itself.
• Java was originally developed by James Gosling at Sun
Microsystems. It was released in May 1995 as a core
component of Sun's Java platform.
Java Features:
The prime reason behind creation of Java was to bring: portability and security
feature into a computer language.
• Beside these two major features, there were many other features that played an
important role in moulding out the final form of this outstanding language.
Secure • When it comes to security, Java is always the first choice. With java secure
features it enable us to develop virus free, temper free system. • Java program
always runs in Java runtime environment with almost null interaction with system
OS, hence it is more secure.
•No explicit pointer
•Java Programs run inside a virtual machine sandbox
4.Simple • Java is easy to learn and its syntax is quite simple, clean and easy to understand.
The confusing and ambiguous concepts of C++ are either left out in Java or they have been
re-implemented in a cleaner way. • Eg : Pointers and Operator Overloading are not there in
java but were an important part of C++.
5.Object Oriented • In java everything is Object which has some data and behaviour. Java
can be easily extended as it is on Object Model. • Robust • Java makes an effort to eliminate
error prone codes by emphasizing mainly on compile time error checking and runtime
checking. But the main areas which Java improved were Memory Management and
mishandled Exceptions by introducing automatic Garbage Collector and Exception Handling
6.Platform Independent • Unlike other programming languages such as C, C++ etc which
are compiled into platform specific machines. Java is guaranteed to be write-once, run-
anywhere language. • On compilation Java program is compiled into bytecode. This bytecode
is platform independent and can be run on any machine, plus this bytecode format also
provide security. Any machine with Java Runtime Environment can run Java
Secure
Platform Independent
Java and c++:
Comparison Index C++ Java
Platform-independent C++ is platform-dependent. Java is platform-independent.
Mainly used for C++ is mainly used for system programming. Java is mainly used for application programming. It is widely
used in Windows-based, web-based, enterprise, and mobile
applications.
Design Goal C++ was designed for systems and applications programming. It
was an extension of the C programming language.
Java was designed and created as an interpreter for printing
systems but later extended as a support network computing. It
was designed to be easy to use and accessible to a broader
audience.
Goto C++ supports the goto statement. Java doesn't support the goto statement.
Multiple inheritance C++ supports multiple inheritance. Java doesn't support multiple inheritance through class. It can be
achieved by using interfaces in java.
Operator Overloading C++ supports operator overloading. Java doesn't support operator overloading.
Pointers C++ supports pointers. You can write a pointer program in C++. Java supports pointer internally. However, you can't write the
pointer program in java. It means java has restricted pointer
support in java.
Compiler and Interpreter C++ uses compiler only. C++ is compiled and run using the
compiler which converts source code into machine code so, C++
is platform dependent.
Java uses both compiler and interpreter. Java source code is
converted into bytecode at compilation time. The interpreter
executes this bytecode at runtime and produces output. Java is
interpreted that is why it is platform-independent.
Call by Value and Call by reference C++ supports both call by value and call by reference. Java supports call by value only. There is no call by reference in
java.
Structure and Union C++ supports structures and unions. Java doesn't support structures and unions.
Thread Support C++ doesn't have built-in support for threads. It relies on third-
party libraries for thread support.
Java has built-in thread support.
Documentation comment C++ doesn't support documentation comments. Java supports documentation comment (/** ... */) to create
documentation for java source code.
Virtual Keyword C++ supports virtual keyword so that we can decide whether or
not to override a function.
Java has no virtual keyword. We can override all non-static
methods by default. In other words, non-static methods are virtual
by default.
unsigned right shift >>> C++ doesn't support >>> operator. Java supports unsigned right shift >>> operator that fills zero at
the top for the negative numbers. For positive numbers, it works
same like >> operator.
Inheritance Tree C++ always creates a new inheritance tree. Java always uses a single inheritance tree because all classes are
the child of the Object class in Java. The Object class is the root
of the inheritance tree in java.
Hardware C++ is nearer to hardware. Java is not so interactive with hardware.
Object-oriented C++ is an object-oriented language. However, in the C language,
a single root hierarchy is not possible.
Java is also an object-oriented language. However, everything
(except fundamental types) is an object in Java. It is a single root
hierarchy as everything gets derived from java.lang.Object.
Java Environment:
Java development kit:
• The Java Development Kit (JDK) is a software
development environment used for developing Java
applications and applets. It includes the Java
Runtime Environment (JRE).
• Javac (java compiler)
• Applet viewer(for viewing java applet)
• Java (java interpreter)
• Javap ( java disassembler)
• Javah (for c header files)
• Javadoc (for creating HTML documents)
• Jdb( java debugger)
Unit 1- Basic concept of object-oriented-programming.ppt
Application programming
interface
• Application programming interface(API) includes
hundreds of classes and methods grouped into several
functional package.
• Language support Package:
A collection of classes and methods required for
implementing basic features of java
Utilities Package:
A collection of class to provide utility function such as
date and time function.
• Input/Output Package:
A collection of classes required for input and output manipulation.
Network Package:
A collection of classes for communicating with other computers via
internet.
Applet Package:
This includes a set of classes that allows us to create Java applet.
Java Virtual machine:
It is a program that interprets the intermediate java byte code and
generate the desired output
Runtime class Libraries:
These are a set of core class libraries that are required for the
execution of java program
• User interface Toolkit:
AWT and swing are the examples of toolkit that support
varied input methods for the users to interact with the
application program.
Deployment Technologies:
Java plug-in: Enable the execution of a java applet on
the browser.
Java Web start: User can launch an application directly
from the web browser without going through the
installation procedure.
Unit 1- Basic concept of object-oriented-programming.ppt
Overview of Java:
Introduction:
Java is a object-oriented programming language.
There are two types of java program,
 Stand alone application
 Web applets
Stand alone application:
A type of software program that is designed to run on a
single computer or local machine of the user, without the need
for a server or internet connection.
Executing a stand alone java program involves two steps,
• Compiling source code into byte code using javac
compiler.
• Executing the bytecode program using java interpreter.
Web Applets:
An applet is a small program that runs within an
application. Applets are commonly used to make
otherwise static Web pages more interactive. Examples
include animated graphics, games, configurable bar
charts and scrolling messages. Applets also play an
important role in network computers (NCs).
Simple Java Program:
Class Declaration:
• Declares the name of the class along with other attributes such as
the class's superclass, and whether the class is public, final, or
abstract.
Opening Brace:
Every Class Definition in java begings with an opening
brace”{“ and ends with a matching closing brace “}” in last line.
The Main Line:
The Java main method is the entry point of any Java application.
The most common method to call main is public static void
main(String[] args) It's the starting point where the Java Virtual
Machine (JVM) begins executing your program.
Public:
The public keyword is an access modifier used for classes, attributes, methods
and constructors, making them accessible by any other class.
Static:
• When you declare a variable or a method as static, it belongs to the class,
rather than a specific instance.
Void:
• In Java, the void keyword is a reserved type used mainly to specify that a
method does not return any data type.
• Println:
A println() in Java is also utilised to display a text on the console,
which is the parameter to this method in String. This method also enables
printing the text on the console, and the cursor remains at the start of the
following line at the console.
Java Program Structure:
• Java is an object-oriented programming, platform-
independent, and secure programming language that
makes it popular.
• Using the Java programming language, we can develop a
wide variety of applications. So, before diving in depth, it
is necessary to understand the basic structure of Java
program in detail.
• In this section, we have discussed the basic structure of
a Java program. At the end of this section, you will able
to develop the Hello world Java program, easily.
Documentation
Section
• The documentation section is an important section but optional for a Java
program. It includes basic information about a Java program. The
information includes the author's name, date of creation, version, program
name, company name, and description of the program. It improves the
readability of the program. Whatever we write in the documentation section,
the Java compiler ignores the statements during the execution of the program.
To write the statements in the documentation section, we use comments. The
comments may be single-line, multi-line, and documentation comments.
• Single-line Comment: It starts with a pair of forwarding slash (//). For
example:
1.//First Java Program
• Multi-line Comment: It starts with a /* and ends with */. We write between
these two symbols. For example:
1./*It is an example of
2.multiline comment*/
• Documentation Comment: It starts with the delimiter (/**) and ends with */.
Package
Declaration
• The package declaration is optional. It is placed just after the
documentation section. In this section, we declare the package
name in which the class is placed. Note that there can be only one
package statement in a Java program. It must be defined before any
class and interface declaration. It is necessary because a Java class can
be placed in different packages and directories based on the module
they are used. For all these classes package belongs to a single parent
directory. We use the keyword package to declare the package name.
For example:
1.package javatpoint; //where javatpoint is the package name
2.package com.javatpoint; //where com is the root directory and javatpoi
nt is the subdirectory
Import
Statements
• The package contains the many predefined classes and interfaces. If
we want to use any class of a particular package, we need to import
that class. The import statement represents the class stored in the other
package. We use the import keyword to import the class. It is written
before the class declaration and after the package statement. We use
the import statement in two ways, either import a specific class or
import all classes of a particular package. In a Java program, we can
use multiple import statements. For example:
1.import java.util.Scanner; //it imports the Scanner class only
2.import java.util.*; //it imports all the class of the java.util package
Interface Section
• It is an optional section. We can create an interface in this section if
required. We use the interface keyword to create an interface.
An interface is a slightly different from the class. It contains
only constants and method declarations. Another difference is that it
cannot be instantiated. We can use interface in classes by using
the implements keyword. An interface can also be used with other
interfaces by using the extends keyword. For example:
1. interface car
2. {
3. void start();
4. void stop();
5. }
Class Definition
• In this section, we define the class. It is vital part of a Java
program. Without the class, we cannot create any Java program. A
Java program may conation more than one class definition. We use
the class keyword to define the class. The class is a blueprint of a
Java program. It contains information about user-defined methods,
variables, and constants. Every Java program has at least one class
that contains the main() method. For example:
1.class Student //class definition
2.{
3.}
Main Method Class
• In this section, we define the main() method. It is essential for all
Java programs. Because the execution of all Java programs starts
from the main() method. In other words, it is an entry point of the
class. It must be inside the class. Inside the main method, we create
objects and call the methods. We use the following statement to
define the main() method:
1.public static void main(String args[])
2.{
3.}
Java Tokens:
• In Java, the program contains classes and methods. Further, the
methods contain the expressions and statements required to perform a
specific operation. These statements and expressions are made up
of tokens. In other words, we can say that the expression and
statement is a set of tokens. The tokens are the small building
blocks of a Java program that are meaningful to
the Java compiler. Further, these two components contain variables,
constants, and operators. In this section, we will discuss what is
tokens in Java.
What is token in Java?
• The Java compiler breaks the line of code into text (words) is
called Java tokens. These are the smallest element of the Java
program. The Java compiler identified these words as tokens. These
tokens are separated by the delimiters. It is useful for compilers to
detect errors. Remember that the delimiters are not part of the Java
tokens.
Unit 1- Basic concept of object-oriented-programming.ppt
Types of Tokens
• Keywords
• Identifiers
• Literals
• Operators
• Separators
• Comments
Keywords: These are the pre-defined reserved words of any
programming language. Each keyword has a special
meaning. It is always written in lower case, because java is
case-sensitive. Java provides the following keywords:
01. Abstract 02. Boolean 03. Byte 04. Break 05. Class
06. Case 07. Catch 08. Char 09. Continue 10. Default
11. Do 12. Double 13. Else 14. Extends 15. Final
16. Finally 17. Float 18. For 19. If 20. Implements
21. Import 22. Instanceof 23. Int 24. Interface 25. Long
26. Native 27. New 28. Package 29. Private 30. Protected
31. Public 32. Return 33. Short 34. Static 35. Super
36. Switch 37. Synchronized 38.This 39.Thro 40.Throws
41.Transient 42.Try 43.Void 44.Volatile 45. While
46. Assert 47. Const 48. Enum 49. Goto 50. Strictfp
Identifier:
• Identifiers are used to name a variable, constant, function, class, and array.
It usually defined by the user. It uses letters, underscores, or a dollar sign as the
first character. The label is also known as a special kind of identifier that is used
in the goto statement. Remember that the identifier name must be different from
the reserved keywords. There are some rules to declare identifiers are:
• The first letter of an identifier must be a letter, underscore or a dollar sign. It
cannot start with digits but may contain digits.
• The whitespace cannot be included in the identifier.
• Identifiers are case sensitive.
• Some valid identifiers are:
1. PhoneNumber
2. PRICE
3. radius
4. a
5. a1
6. _phonenumber
7. $circumference
8. jagged_array
Literals:
• In programming literal is a notation that represents a fixed value (constant) in the
source code. It can be categorized as an integer literal, string literal, Boolean literal, etc.
It is defined by the programmer. Once it has been defined cannot be changed. Java
provides five types of literals are as follows:
• Integer
• Floating Point
• Character
• String
• Boolean
Literal Type
23 int
9.86 double
false, true boolean
'K', '7', '-' char
"javatpoint" String
null any reference type
Operators:
• In programming, operators are the special symbol that tells the
compiler to perform a special operation. Java provides different types of
operators that can be classified according to the functionality they provide.
There are eight types of operators in Java, are as follows:
• Arithmetic Operators
• Assignment Operators
• Relational Operators
• Unary Operators
• Logical Operators
• Ternary Operators
• Bitwise Operators
• Shift Operators
Operator Symbols
Arithmetic + , - , / , * , %
Unary ++ , - - , !
Assignment = , += , -= , *= , /= , %= , ^=
Relational ==, != , < , >, <= , >=
Logical && , ||
Ternary (Condition) ? (Statement1) : (Statement2);
Bitwise & , | , ^ , ~
Shift << , >> , >>>
Separators
• The separators in Java is also known as punctuators. There are nine separators
in Java, are as follows:
1. separator <= ; | , | . | ( | ) | { | } | [ | ]
• Square Brackets []: It is used to define array elements. A pair of square brackets
represents the single-dimensional array, two pairs of square brackets represent the
two-dimensional array.
• Parentheses (): It is used to call the functions and parsing the parameters.
• Curly Braces {}: The curly braces denote the starting and ending of a code block.
• Comma (,): It is used to separate two values, statements, and parameters.
• Assignment Operator (=): It is used to assign a variable and constant.
• Semicolon (;): It is the symbol that can be found at end of the statements. It
separates the two statements.
• Period (.): It separates the package name form the sub-packages and class. It also
separates a variable or method from a reference variable.
separator <= ; | , | . | ( | ) | { | } | [ | ]
Java statement:
Implementing a java program:
• Create the program by typing it into a text editor and
saving it to a file – HelloWorld.java.
• Compile it by typing “javac HelloWorld.java” in the
terminal window.
• Execute (or run) it by typing “java HelloWorld” in the
terminal window.
JVM (Java Virtual Machine)
Architecture
1.Java Virtual Machine
2.Internal Architecture of JVM
• JVM (Java Virtual Machine) is an abstract machine. It
is a specification that provides runtime environment
(JRE) in which java bytecode can be executed.
• JVMs are available for many hardware and software
platforms (i.e. JVM is platform dependent).
Unit 1- Basic concept of object-oriented-programming.ppt

More Related Content

Similar to Unit 1- Basic concept of object-oriented-programming.ppt (20)

Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
LakshyaChauhan21
 
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbxchapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
berihun18
 
Introduction to Object Oriented Programming.pptx
Introduction to Object Oriented Programming.pptxIntroduction to Object Oriented Programming.pptx
Introduction to Object Oriented Programming.pptx
ssuser8d54ed
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)
Jay Patel
 
2 Object Oriented Programming
2 Object Oriented Programming2 Object Oriented Programming
2 Object Oriented Programming
Praveen M Jigajinni
 
OOPS_Unit_1
OOPS_Unit_1OOPS_Unit_1
OOPS_Unit_1
Shipra Swati
 
Computer_Programming_Part_II_Segment_01.pdf
Computer_Programming_Part_II_Segment_01.pdfComputer_Programming_Part_II_Segment_01.pdf
Computer_Programming_Part_II_Segment_01.pdf
et243047
 
Oop basic overview
Oop basic overviewOop basic overview
Oop basic overview
Deborah Akuoko
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
𝗦𝗵𝗶𝘃𝗮𝗺 𝗝𝗼𝘀𝗵𝗶
 
INTRODUCTION TO JAVA
INTRODUCTION TO JAVAINTRODUCTION TO JAVA
INTRODUCTION TO JAVA
RAMALINGHAM KRISHNAMOORTHY
 
L1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdfL1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdfSulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
SULTHAN BASHA
 
1unit-120324103142-phpapp02.pdf
1unit-120324103142-phpapp02.pdf1unit-120324103142-phpapp02.pdf
1unit-120324103142-phpapp02.pdf
SahajShrimal1
 
Block_1_Unit- I.pdf bca learning for exam you
Block_1_Unit- I.pdf  bca learning  for exam youBlock_1_Unit- I.pdf  bca learning  for exam you
Block_1_Unit- I.pdf bca learning for exam you
vosawe9128
 
Chapter1
Chapter1Chapter1
Chapter1
jammiashok123
 
1 intro
1 intro1 intro
1 intro
abha48
 
Oops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaOops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
OOP.pptx
OOP.pptxOOP.pptx
OOP.pptx
kalyanibedekar
 
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptx
YashKoli22
 
1669609053088_oops_final.pptx
1669609053088_oops_final.pptx1669609053088_oops_final.pptx
1669609053088_oops_final.pptx
PandeeswariKannan
 
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbxchapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
berihun18
 
Introduction to Object Oriented Programming.pptx
Introduction to Object Oriented Programming.pptxIntroduction to Object Oriented Programming.pptx
Introduction to Object Oriented Programming.pptx
ssuser8d54ed
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)
Jay Patel
 
Computer_Programming_Part_II_Segment_01.pdf
Computer_Programming_Part_II_Segment_01.pdfComputer_Programming_Part_II_Segment_01.pdf
Computer_Programming_Part_II_Segment_01.pdf
et243047
 
L1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdfL1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdfSulthan's_JAVA_Material_for_B.Sc-CS.pdf
Sulthan's_JAVA_Material_for_B.Sc-CS.pdf
SULTHAN BASHA
 
1unit-120324103142-phpapp02.pdf
1unit-120324103142-phpapp02.pdf1unit-120324103142-phpapp02.pdf
1unit-120324103142-phpapp02.pdf
SahajShrimal1
 
Block_1_Unit- I.pdf bca learning for exam you
Block_1_Unit- I.pdf  bca learning  for exam youBlock_1_Unit- I.pdf  bca learning  for exam you
Block_1_Unit- I.pdf bca learning for exam you
vosawe9128
 
1 intro
1 intro1 intro
1 intro
abha48
 
Oops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaOops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptx
YashKoli22
 
1669609053088_oops_final.pptx
1669609053088_oops_final.pptx1669609053088_oops_final.pptx
1669609053088_oops_final.pptx
PandeeswariKannan
 

More from hannahroseline2 (9)

v5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptxv5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
cascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptxcascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
Database Design in web and web database design
Database Design in web and web database designDatabase Design in web and web database design
Database Design in web and web database design
hannahroseline2
 
introduction of HTML canvas and styles .pptx
introduction of HTML canvas and styles .pptxintroduction of HTML canvas and styles .pptx
introduction of HTML canvas and styles .pptx
hannahroseline2
 
UNIX OPERATING SYSTEM Internals and Architecture.pptx
UNIX OPERATING SYSTEM Internals and Architecture.pptxUNIX OPERATING SYSTEM Internals and Architecture.pptx
UNIX OPERATING SYSTEM Internals and Architecture.pptx
hannahroseline2
 
wholeness of data analytics in cyber security.ppt
wholeness of data analytics in cyber security.pptwholeness of data analytics in cyber security.ppt
wholeness of data analytics in cyber security.ppt
hannahroseline2
 
What is data analytics ,Data science,Data processing chain,regression,decisio...
What is data analytics ,Data science,Data processing chain,regression,decisio...What is data analytics ,Data science,Data processing chain,regression,decisio...
What is data analytics ,Data science,Data processing chain,regression,decisio...
hannahroseline2
 
OOPs concept and java Environment decsion making statement looping array and ...
OOPs concept and java Environment decsion making statement looping array and ...OOPs concept and java Environment decsion making statement looping array and ...
OOPs concept and java Environment decsion making statement looping array and ...
hannahroseline2
 
Cyberstalking CyberstalkingCyberstalking
Cyberstalking CyberstalkingCyberstalkingCyberstalking CyberstalkingCyberstalking
Cyberstalking CyberstalkingCyberstalking
hannahroseline2
 
v5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptxv5-introduction to html-css-210321161444.pptx
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
cascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptxcascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
Database Design in web and web database design
Database Design in web and web database designDatabase Design in web and web database design
Database Design in web and web database design
hannahroseline2
 
introduction of HTML canvas and styles .pptx
introduction of HTML canvas and styles .pptxintroduction of HTML canvas and styles .pptx
introduction of HTML canvas and styles .pptx
hannahroseline2
 
UNIX OPERATING SYSTEM Internals and Architecture.pptx
UNIX OPERATING SYSTEM Internals and Architecture.pptxUNIX OPERATING SYSTEM Internals and Architecture.pptx
UNIX OPERATING SYSTEM Internals and Architecture.pptx
hannahroseline2
 
wholeness of data analytics in cyber security.ppt
wholeness of data analytics in cyber security.pptwholeness of data analytics in cyber security.ppt
wholeness of data analytics in cyber security.ppt
hannahroseline2
 
What is data analytics ,Data science,Data processing chain,regression,decisio...
What is data analytics ,Data science,Data processing chain,regression,decisio...What is data analytics ,Data science,Data processing chain,regression,decisio...
What is data analytics ,Data science,Data processing chain,regression,decisio...
hannahroseline2
 
OOPs concept and java Environment decsion making statement looping array and ...
OOPs concept and java Environment decsion making statement looping array and ...OOPs concept and java Environment decsion making statement looping array and ...
OOPs concept and java Environment decsion making statement looping array and ...
hannahroseline2
 
Cyberstalking CyberstalkingCyberstalking
Cyberstalking CyberstalkingCyberstalkingCyberstalking CyberstalkingCyberstalking
Cyberstalking CyberstalkingCyberstalking
hannahroseline2
 
Ad

Recently uploaded (20)

IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Adam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational PsychologyAdam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational Psychology
Prachi Shah
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 SalesHow to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle SchoolExploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
Respiratory System , Urinary System
Respiratory  System , Urinary SystemRespiratory  System , Urinary System
Respiratory System , Urinary System
RushiMandali
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptxFinal Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition OecdEnergy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Celine George
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptxSEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
PoojaSen20
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Adam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational PsychologyAdam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational Psychology
Prachi Shah
 
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxDiptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptx
Arshad Shaikh
 
How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 SalesHow to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle SchoolExploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
Respiratory System , Urinary System
Respiratory  System , Urinary SystemRespiratory  System , Urinary System
Respiratory System , Urinary System
RushiMandali
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptxFinal Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition OecdEnergy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Celine George
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptxSEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
PoojaSen20
 
Ad

Unit 1- Basic concept of object-oriented-programming.ppt

  • 1. UNIT 1 FUNDAMENTALS OF OBJECT- ORIENTED PROGRAMMING Basic Concepts Of Object Oriented Programming And Java Environment By Hannah Roseline Assistant Professor
  • 2. Introduction To Object Oriented Programming:  Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs.  Programming techniques may include features such as data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance. Many modern programming languages now support OOP.  OOP Which form the heart of java Language. Definition of OOP: Object- oriented programming is an approach that provides a way of modularizing program by creating partitioned memory area for both data and function that can be used as templates for creating copies of such modules On demand.
  • 3. Programming Paradigm : A programming paradigm is a fundamental style of computer programming. Paradigms differ in the concepts and abstractions used to represent the elements of a program (such as objects, functions, variables, constraints, etc.) and the steps that compose a computation (assignment, evaluation, continuations, data flows, etc.). The combination of data and method make up an object.
  • 4. Basic Concept Of OOP: Object: Objects are the basic runtime entities in an object oriented system. They may represent a person, a place, a bank account, a table of data or any item that the program has to handle. An object is an instance of class that allows programmes to use variable and method inside the class
  • 5. Object: • Object is an run time entity. • Is an Instance of class • Represents a Place ,Person ,anything that have some attributes.
  • 6. Class: • Object contains data, and code to manipulate that data. The entire set of data and code of an object can be made a user- defined data type with the help of a class • A class is a blueprint or template for declaring and creating object.
  • 7. • A Class is a 3-Compartment Box encapsulating Data and Functions • Class name (or identifier): identifies the class. • Data Members or Variables (or attributes, states, fields): contains the static attributes of the class. • Member Functions (or methods, behaviours, operations): Contains the dynamic operations of the class.
  • 8. Data Encapsulation: The wrapping up of data and functions into a single unit is known as encapsulation. The data is not accessible to the outside world, only those function which are wrapped in the can access it. These functions provide the interface between the object’s data and the program. This insulation of the data from direct access by the program is called data hiding or information hiding.
  • 9. Data Abstraction  Abstraction refers to the act of representing essential features without including the background details or explanations.  Since classes use the concept of data abstraction, they are known as abstract data types (adt)
  • 10. Data Encapsulation And Abstraction: • Data encapsulation, sometimes referred to as data hiding. • Data Encapsulation and Data Abstraction is one of the most striking feature of object oriented programming. • The wrapping up of data and code into a single unit is called data encapsulation. The data is not accessible to the outside world only those functions which are wrapped into a class can only access the private data of the class.
  • 11. Inheritance : • Inheritance is one of the most striking feature of object oriented programming. • Inheritance is the process by which one class can acquire the properties of another class. • The new classes, known as subclasses (or derived classes), inherit attributes and behavior of the pre-existing classes, which are referred to as superclasses (or ancestor classes). The inheritance relationships of classes gives rise to a hierarchy • Inheritance is the process by which objects of one class acquire the properties of objects of another class • In OOP, the concept of inheritance provides the idea of reusability. This means we can add additional features to an existing class without modifying it.
  • 13. • A superclass, base class, or parent class is a class from which other classes are derived. The classes that are derived from a super class are known as child classes, derived classes, or subclasses. • In object-oriented programming (OOP), inheritance is a way to compartmentalize and reuse code by creating collections of attributes and behaviors called objects which can be based on previously created objects.
  • 14. Polymorphism:  Polymorphism, a Greek term means to ability to take more than one form.  An operation may exhibits different behaviors in different instances. The behavior depends upon the type of data used in the operation.  For example consider the operation of addition for two numbers; the operation will generate a sum. If the operands are string then the operation would produce a third string by concatenation.  The process of making an operator to exhibit different behavior in different instances is known operator overloading
  • 15. BenefitsOf OOP OOP offers several benefits to both the program designer & the user Through inheritance, we can eliminate redundant code and extend the use of existing class We can build programs from the standard working module the communicate with one another, rather than having to start writing code from scratch. This leads to saving of development time & higher productivity. The principle of data hiding helps the programmer to build & secure programs that cannot be invaded by code in other parts of the program. It is possible to map objects in the problem domain to those in the program It is easy to partition the work in a project based on objects The data-centered design approach enables us to capture more details of a model in implementable form. •.
  • 16.  Object-oriented systems can be easily upgraded from small to large systems.  Message passing techniques for communication between objects makes the interface descriptions with external systems much simpler.  Software complexity can be easily managed .  While it is possible to incorporate all these features in an object- oriented system, their importance depends on the type of the project and the preference of the programmer. There are a number of issues that need to be tackled to reap some of the benefits stated above. For instance, object libraries must be available for reuse. The technology is still developing and current products may be superseded quickly. Strict controls and protocols need to be compromised
  • 17. Application of OOP: • Real-business systems are often much more complex and contain many more objects with complicated attributes and methods. OOP is useful in these types of applications because it can simplify a complex problem. The promising areas for application of OOP include:  Real-time systems  Simulation and modeling  Object-oriented databases  Hypertext, hypermedia and expertext  Al and expert systems  Neural networks and parallel programming  Decision support and office automation systems  CIM/CAM/CAD systems(computer Aided manufacturing)(computer aided design).
  • 18. About java: • Java is a widely-used programming language for coding web applications. It has been a popular choice among developers for over two decades, with millions of Java applications in use today. Java is a multi-platform, object- oriented, and network-centric language that can be used as a platform in itself. • Java was originally developed by James Gosling at Sun Microsystems. It was released in May 1995 as a core component of Sun's Java platform.
  • 20. The prime reason behind creation of Java was to bring: portability and security feature into a computer language. • Beside these two major features, there were many other features that played an important role in moulding out the final form of this outstanding language. Secure • When it comes to security, Java is always the first choice. With java secure features it enable us to develop virus free, temper free system. • Java program always runs in Java runtime environment with almost null interaction with system OS, hence it is more secure. •No explicit pointer •Java Programs run inside a virtual machine sandbox
  • 21. 4.Simple • Java is easy to learn and its syntax is quite simple, clean and easy to understand. The confusing and ambiguous concepts of C++ are either left out in Java or they have been re-implemented in a cleaner way. • Eg : Pointers and Operator Overloading are not there in java but were an important part of C++. 5.Object Oriented • In java everything is Object which has some data and behaviour. Java can be easily extended as it is on Object Model. • Robust • Java makes an effort to eliminate error prone codes by emphasizing mainly on compile time error checking and runtime checking. But the main areas which Java improved were Memory Management and mishandled Exceptions by introducing automatic Garbage Collector and Exception Handling 6.Platform Independent • Unlike other programming languages such as C, C++ etc which are compiled into platform specific machines. Java is guaranteed to be write-once, run- anywhere language. • On compilation Java program is compiled into bytecode. This bytecode is platform independent and can be run on any machine, plus this bytecode format also provide security. Any machine with Java Runtime Environment can run Java
  • 23. Java and c++: Comparison Index C++ Java Platform-independent C++ is platform-dependent. Java is platform-independent. Mainly used for C++ is mainly used for system programming. Java is mainly used for application programming. It is widely used in Windows-based, web-based, enterprise, and mobile applications. Design Goal C++ was designed for systems and applications programming. It was an extension of the C programming language. Java was designed and created as an interpreter for printing systems but later extended as a support network computing. It was designed to be easy to use and accessible to a broader audience. Goto C++ supports the goto statement. Java doesn't support the goto statement. Multiple inheritance C++ supports multiple inheritance. Java doesn't support multiple inheritance through class. It can be achieved by using interfaces in java. Operator Overloading C++ supports operator overloading. Java doesn't support operator overloading. Pointers C++ supports pointers. You can write a pointer program in C++. Java supports pointer internally. However, you can't write the pointer program in java. It means java has restricted pointer support in java. Compiler and Interpreter C++ uses compiler only. C++ is compiled and run using the compiler which converts source code into machine code so, C++ is platform dependent. Java uses both compiler and interpreter. Java source code is converted into bytecode at compilation time. The interpreter executes this bytecode at runtime and produces output. Java is interpreted that is why it is platform-independent. Call by Value and Call by reference C++ supports both call by value and call by reference. Java supports call by value only. There is no call by reference in java. Structure and Union C++ supports structures and unions. Java doesn't support structures and unions. Thread Support C++ doesn't have built-in support for threads. It relies on third- party libraries for thread support. Java has built-in thread support. Documentation comment C++ doesn't support documentation comments. Java supports documentation comment (/** ... */) to create documentation for java source code. Virtual Keyword C++ supports virtual keyword so that we can decide whether or not to override a function. Java has no virtual keyword. We can override all non-static methods by default. In other words, non-static methods are virtual by default. unsigned right shift >>> C++ doesn't support >>> operator. Java supports unsigned right shift >>> operator that fills zero at the top for the negative numbers. For positive numbers, it works same like >> operator. Inheritance Tree C++ always creates a new inheritance tree. Java always uses a single inheritance tree because all classes are the child of the Object class in Java. The Object class is the root of the inheritance tree in java. Hardware C++ is nearer to hardware. Java is not so interactive with hardware. Object-oriented C++ is an object-oriented language. However, in the C language, a single root hierarchy is not possible. Java is also an object-oriented language. However, everything (except fundamental types) is an object in Java. It is a single root hierarchy as everything gets derived from java.lang.Object.
  • 25. Java development kit: • The Java Development Kit (JDK) is a software development environment used for developing Java applications and applets. It includes the Java Runtime Environment (JRE). • Javac (java compiler) • Applet viewer(for viewing java applet) • Java (java interpreter) • Javap ( java disassembler) • Javah (for c header files) • Javadoc (for creating HTML documents) • Jdb( java debugger)
  • 27. Application programming interface • Application programming interface(API) includes hundreds of classes and methods grouped into several functional package. • Language support Package: A collection of classes and methods required for implementing basic features of java Utilities Package: A collection of class to provide utility function such as date and time function.
  • 28. • Input/Output Package: A collection of classes required for input and output manipulation. Network Package: A collection of classes for communicating with other computers via internet. Applet Package: This includes a set of classes that allows us to create Java applet. Java Virtual machine: It is a program that interprets the intermediate java byte code and generate the desired output Runtime class Libraries: These are a set of core class libraries that are required for the execution of java program
  • 29. • User interface Toolkit: AWT and swing are the examples of toolkit that support varied input methods for the users to interact with the application program. Deployment Technologies: Java plug-in: Enable the execution of a java applet on the browser. Java Web start: User can launch an application directly from the web browser without going through the installation procedure.
  • 31. Overview of Java: Introduction: Java is a object-oriented programming language. There are two types of java program,  Stand alone application  Web applets Stand alone application: A type of software program that is designed to run on a single computer or local machine of the user, without the need for a server or internet connection. Executing a stand alone java program involves two steps, • Compiling source code into byte code using javac compiler. • Executing the bytecode program using java interpreter.
  • 32. Web Applets: An applet is a small program that runs within an application. Applets are commonly used to make otherwise static Web pages more interactive. Examples include animated graphics, games, configurable bar charts and scrolling messages. Applets also play an important role in network computers (NCs).
  • 34. Class Declaration: • Declares the name of the class along with other attributes such as the class's superclass, and whether the class is public, final, or abstract. Opening Brace: Every Class Definition in java begings with an opening brace”{“ and ends with a matching closing brace “}” in last line. The Main Line: The Java main method is the entry point of any Java application. The most common method to call main is public static void main(String[] args) It's the starting point where the Java Virtual Machine (JVM) begins executing your program.
  • 35. Public: The public keyword is an access modifier used for classes, attributes, methods and constructors, making them accessible by any other class. Static: • When you declare a variable or a method as static, it belongs to the class, rather than a specific instance. Void: • In Java, the void keyword is a reserved type used mainly to specify that a method does not return any data type. • Println: A println() in Java is also utilised to display a text on the console, which is the parameter to this method in String. This method also enables printing the text on the console, and the cursor remains at the start of the following line at the console.
  • 37. • Java is an object-oriented programming, platform- independent, and secure programming language that makes it popular. • Using the Java programming language, we can develop a wide variety of applications. So, before diving in depth, it is necessary to understand the basic structure of Java program in detail. • In this section, we have discussed the basic structure of a Java program. At the end of this section, you will able to develop the Hello world Java program, easily.
  • 38. Documentation Section • The documentation section is an important section but optional for a Java program. It includes basic information about a Java program. The information includes the author's name, date of creation, version, program name, company name, and description of the program. It improves the readability of the program. Whatever we write in the documentation section, the Java compiler ignores the statements during the execution of the program. To write the statements in the documentation section, we use comments. The comments may be single-line, multi-line, and documentation comments. • Single-line Comment: It starts with a pair of forwarding slash (//). For example: 1.//First Java Program • Multi-line Comment: It starts with a /* and ends with */. We write between these two symbols. For example: 1./*It is an example of 2.multiline comment*/ • Documentation Comment: It starts with the delimiter (/**) and ends with */.
  • 39. Package Declaration • The package declaration is optional. It is placed just after the documentation section. In this section, we declare the package name in which the class is placed. Note that there can be only one package statement in a Java program. It must be defined before any class and interface declaration. It is necessary because a Java class can be placed in different packages and directories based on the module they are used. For all these classes package belongs to a single parent directory. We use the keyword package to declare the package name. For example: 1.package javatpoint; //where javatpoint is the package name 2.package com.javatpoint; //where com is the root directory and javatpoi nt is the subdirectory
  • 40. Import Statements • The package contains the many predefined classes and interfaces. If we want to use any class of a particular package, we need to import that class. The import statement represents the class stored in the other package. We use the import keyword to import the class. It is written before the class declaration and after the package statement. We use the import statement in two ways, either import a specific class or import all classes of a particular package. In a Java program, we can use multiple import statements. For example: 1.import java.util.Scanner; //it imports the Scanner class only 2.import java.util.*; //it imports all the class of the java.util package
  • 41. Interface Section • It is an optional section. We can create an interface in this section if required. We use the interface keyword to create an interface. An interface is a slightly different from the class. It contains only constants and method declarations. Another difference is that it cannot be instantiated. We can use interface in classes by using the implements keyword. An interface can also be used with other interfaces by using the extends keyword. For example: 1. interface car 2. { 3. void start(); 4. void stop(); 5. }
  • 42. Class Definition • In this section, we define the class. It is vital part of a Java program. Without the class, we cannot create any Java program. A Java program may conation more than one class definition. We use the class keyword to define the class. The class is a blueprint of a Java program. It contains information about user-defined methods, variables, and constants. Every Java program has at least one class that contains the main() method. For example: 1.class Student //class definition 2.{ 3.}
  • 43. Main Method Class • In this section, we define the main() method. It is essential for all Java programs. Because the execution of all Java programs starts from the main() method. In other words, it is an entry point of the class. It must be inside the class. Inside the main method, we create objects and call the methods. We use the following statement to define the main() method: 1.public static void main(String args[]) 2.{ 3.}
  • 44. Java Tokens: • In Java, the program contains classes and methods. Further, the methods contain the expressions and statements required to perform a specific operation. These statements and expressions are made up of tokens. In other words, we can say that the expression and statement is a set of tokens. The tokens are the small building blocks of a Java program that are meaningful to the Java compiler. Further, these two components contain variables, constants, and operators. In this section, we will discuss what is tokens in Java. What is token in Java? • The Java compiler breaks the line of code into text (words) is called Java tokens. These are the smallest element of the Java program. The Java compiler identified these words as tokens. These tokens are separated by the delimiters. It is useful for compilers to detect errors. Remember that the delimiters are not part of the Java tokens.
  • 46. Types of Tokens • Keywords • Identifiers • Literals • Operators • Separators • Comments
  • 47. Keywords: These are the pre-defined reserved words of any programming language. Each keyword has a special meaning. It is always written in lower case, because java is case-sensitive. Java provides the following keywords: 01. Abstract 02. Boolean 03. Byte 04. Break 05. Class 06. Case 07. Catch 08. Char 09. Continue 10. Default 11. Do 12. Double 13. Else 14. Extends 15. Final 16. Finally 17. Float 18. For 19. If 20. Implements 21. Import 22. Instanceof 23. Int 24. Interface 25. Long 26. Native 27. New 28. Package 29. Private 30. Protected 31. Public 32. Return 33. Short 34. Static 35. Super 36. Switch 37. Synchronized 38.This 39.Thro 40.Throws 41.Transient 42.Try 43.Void 44.Volatile 45. While 46. Assert 47. Const 48. Enum 49. Goto 50. Strictfp
  • 48. Identifier: • Identifiers are used to name a variable, constant, function, class, and array. It usually defined by the user. It uses letters, underscores, or a dollar sign as the first character. The label is also known as a special kind of identifier that is used in the goto statement. Remember that the identifier name must be different from the reserved keywords. There are some rules to declare identifiers are: • The first letter of an identifier must be a letter, underscore or a dollar sign. It cannot start with digits but may contain digits. • The whitespace cannot be included in the identifier. • Identifiers are case sensitive. • Some valid identifiers are: 1. PhoneNumber 2. PRICE 3. radius 4. a 5. a1 6. _phonenumber 7. $circumference 8. jagged_array
  • 49. Literals: • In programming literal is a notation that represents a fixed value (constant) in the source code. It can be categorized as an integer literal, string literal, Boolean literal, etc. It is defined by the programmer. Once it has been defined cannot be changed. Java provides five types of literals are as follows: • Integer • Floating Point • Character • String • Boolean Literal Type 23 int 9.86 double false, true boolean 'K', '7', '-' char "javatpoint" String null any reference type
  • 50. Operators: • In programming, operators are the special symbol that tells the compiler to perform a special operation. Java provides different types of operators that can be classified according to the functionality they provide. There are eight types of operators in Java, are as follows: • Arithmetic Operators • Assignment Operators • Relational Operators • Unary Operators • Logical Operators • Ternary Operators • Bitwise Operators • Shift Operators
  • 51. Operator Symbols Arithmetic + , - , / , * , % Unary ++ , - - , ! Assignment = , += , -= , *= , /= , %= , ^= Relational ==, != , < , >, <= , >= Logical && , || Ternary (Condition) ? (Statement1) : (Statement2); Bitwise & , | , ^ , ~ Shift << , >> , >>>
  • 52. Separators • The separators in Java is also known as punctuators. There are nine separators in Java, are as follows: 1. separator <= ; | , | . | ( | ) | { | } | [ | ] • Square Brackets []: It is used to define array elements. A pair of square brackets represents the single-dimensional array, two pairs of square brackets represent the two-dimensional array. • Parentheses (): It is used to call the functions and parsing the parameters. • Curly Braces {}: The curly braces denote the starting and ending of a code block. • Comma (,): It is used to separate two values, statements, and parameters. • Assignment Operator (=): It is used to assign a variable and constant. • Semicolon (;): It is the symbol that can be found at end of the statements. It separates the two statements. • Period (.): It separates the package name form the sub-packages and class. It also separates a variable or method from a reference variable. separator <= ; | , | . | ( | ) | { | } | [ | ]
  • 54. Implementing a java program: • Create the program by typing it into a text editor and saving it to a file – HelloWorld.java. • Compile it by typing “javac HelloWorld.java” in the terminal window. • Execute (or run) it by typing “java HelloWorld” in the terminal window.
  • 55. JVM (Java Virtual Machine) Architecture 1.Java Virtual Machine 2.Internal Architecture of JVM • JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment (JRE) in which java bytecode can be executed. • JVMs are available for many hardware and software platforms (i.e. JVM is platform dependent).