Object Oriented Programming All Unit NotesBalamuruganV28
The document provides an overview of object-oriented programming (OOP) and the Java programming language. It defines key OOP concepts like objects, classes, encapsulation, inheritance, and polymorphism. It also describes features of Java like platform independence, simplicity, security, and robustness. The document then explains basic Java concepts like data types, variables, arrays, control structures, and defining classes, constructors, and methods. It provides examples of operators in Java and the difference between procedural and object-oriented programming.
This document provides an overview of Java programming basics. It discusses object-oriented programming concepts like classes, objects, inheritance, polymorphism and encapsulation. It also covers Java features like platform independence, security, simplicity and performance. Additionally, it describes Java programming fundamentals like variables, data types, operators, expressions and input/output. The document serves as an introduction to the Java language for beginners.
This document provides an introduction to object-oriented programming and Java. It discusses the basics of OOP concepts like classes, objects, encapsulation, inheritance, polymorphism and dynamic binding. It explains the benefits of OOP like modularity, code reuse and information hiding. The document also outlines some key features of the Java programming language like platform independence, security, simplicity and performance. It positions Java as a pure object-oriented language suitable for developing both standalone applications and web applets.
The document provides an overview of Java programming basics. It discusses object-oriented programming concepts like classes, objects, inheritance, polymorphism and encapsulation. It also covers Java features like platform independence, security, simplicity. The document then describes Java programming basics like variables, data types, operators, expressions. It provides examples to explain concepts like declaring variables, assigning values, scope of variables.
Object-oriented programming aims to implement real-world entities as objects that contain both data and functions. Some key characteristics of OOP include classes that act as blueprints for objects, encapsulation that binds data to the functions that operate on it, inheritance that allows classes to inherit properties from other classes, and polymorphism which allows the same message to be displayed in different forms. Advantages of OOP include reusability, flexibility, ease of maintenance and security through features like encapsulation.
Here are some common applications of object-oriented programming and C++:
- Desktop applications like word processors, spreadsheets, etc. The document is an object and formatting, editing operations are methods.
- Game development. Characters, weapons, levels etc. are modeled as objects with behaviors and properties.
- GUI (Graphical User Interface) toolkits like MFC, Qt. Windows, buttons etc. are predefined object classes.
- Web applications and frameworks. Objects represent pages, forms, database entities etc.
- Database connectivity libraries. Objects used to represent rows, columns, connections etc.
- Operating system design. Processes, files, devices modeled as objects.
- Scientific and engineering
This document discusses object-oriented programming (OOP) and its advantages over other programming paradigms. It begins with an introduction to programming paradigms including procedural, object-based, and object-oriented. The key concepts of OOP are then defined, including abstraction, encapsulation, modularity, inheritance, and polymorphism. Advantages of OOP include code reusability, ease of understanding and maintenance. Disadvantages include potential overgeneralization of classes and difficulty of proper planning and design.
Introduction to C++ : Object Oriented Technology, Advantages of OOP, Input- output in
C++, Tokens, Keywords, Identifiers, Data Types C++, Derives data types. The void data
type, Type Modifiers, Typecasting, Constant
This document provides an overview of object-oriented programming (OOP) using C++. It defines key OOP concepts like classes, objects, abstraction, encapsulation, inheritance, and polymorphism. It notes that OOP improves software development productivity and maintainability by making code modular and reusable. OOP also allows for faster development and lower costs due to code reuse. However, OOP has disadvantages like a steep learning curve and producing slower programs in some cases. The document provides examples of where OOP is commonly applied, such as user interfaces, real-time systems, and artificial intelligence.
This document provides an overview of object-oriented programming concepts and their impact. It discusses the history of OOP, which began with Simula in the 1960s. It also outlines key OOP principles like classes, objects, encapsulation, inheritance, and polymorphism. Examples are given to illustrate each concept. The document concludes that OOP is now widely used because it improves code reusability and maintainability compared to older programming models.
Intro to JAVA
Basics of Oops
Features of Oops
Applications of Oops
How to create a JAVA program
How to Edit a Java Program
Compiling a Java program
Java Class file
Run or Executing a Java program
Command line arguments
This Book helps the students who are persuing B.Sc Computer Science in Andhra Pradesh. It made for learning in easiest way. Words have used in this book are very familiar. Any one can understand the language easily. Prefer this book to learn Java.
Here are some common applications of OOP and C++:
- Operating systems like Windows and Linux use OOP principles in their design. Important components like processes, files, devices are modeled as objects.
- Graphics and game development leverage OOP well. Objects can represent game elements like characters, weapons, levels etc. Inheritance helps reduce duplication.
- Desktop applications like word processors and spreadsheets have documents as central objects composed of other objects.
- Database systems use OOP to represent tables as classes and rows as objects. Object-relational mapping is used to interface between OO languages and relational databases.
- Web development frameworks heavily use OOP. Components like HTTP requests/responses, form fields are represented
The document provides an introduction to object-oriented programming concepts. It discusses the key differences between procedural and object-oriented paradigms, including that OOP organizes a program around objects and data rather than procedures. It then defines important OOP concepts like classes, objects, encapsulation, inheritance, polymorphism and messaging passing. The document also provides a brief example of a simple Java program to demonstrate these concepts.
This document provides an introduction to object-oriented programming (OOP) using Java. It defines key OOP concepts like classes, objects, encapsulation, inheritance and polymorphism. It explains the differences between procedural and object-oriented paradigms. Popular OOP languages like Java, C++, Smalltalk are listed, with examples of how classes and objects are used to represent real-world entities like vehicles. The advantages of OOP like code reusability and modular design are also summarized.
This document provides an introduction to object oriented programming (OOP). It defines key concepts in OOP like objects, classes, encapsulation, inheritance, and polymorphism. Objects are the basic runtime entities that can represent any item to be handled in a program. Classes are user-defined data types that contain data and code to manipulate that data. Encapsulation wraps data and functions into a single unit, while inheritance allows classes to inherit properties from other classes. Polymorphism allows operations to exhibit different behaviors depending on the data type. Benefits of OOP include code reuse, easier management of complexity, and better mapping to real world problems. Promising application areas for OOP include real-time systems, simulations, databases
Unit 1 introduces the basics of object-oriented programming (OOP). OOP treats data as objects that contain both data fields (properties) and methods (behaviors). Classes are templates that are used to create objects. Some key principles of OOP include encapsulation, which binds an object's data and methods together, inheritance which allows classes to share structures and behaviors of other classes, and polymorphism which allows different classes to have similarly-named methods that work in different ways. OOP aims to make code reusable, modular, and adaptable to changing requirements compared to traditional procedural programming.
This presentation introduces object-oriented programming (OOP). It discusses the hierarchy of programming paradigms, comparing procedural programming to OOP. The need for OOP is that it models real-world things better and promotes reusability. The main components of OOP discussed are classes, objects, inheritance, polymorphism, encapsulation, and abstraction. Benefits of OOP include reusability, extensibility, and maintainability. The presentation concludes that OOP allows breaking problems into smaller pieces and facilitates upgrading systems from small to large.
Object-oriented programming aims to implement real-world entities as objects that contain both data and functions. Some key characteristics of OOP include classes that act as blueprints for objects, encapsulation that binds data to the functions that operate on it, inheritance that allows classes to inherit properties from other classes, and polymorphism which allows the same message to be displayed in different forms. Advantages of OOP include reusability, flexibility, ease of maintenance and security through features like encapsulation.
Here are some common applications of object-oriented programming and C++:
- Desktop applications like word processors, spreadsheets, etc. The document is an object and formatting, editing operations are methods.
- Game development. Characters, weapons, levels etc. are modeled as objects with behaviors and properties.
- GUI (Graphical User Interface) toolkits like MFC, Qt. Windows, buttons etc. are predefined object classes.
- Web applications and frameworks. Objects represent pages, forms, database entities etc.
- Database connectivity libraries. Objects used to represent rows, columns, connections etc.
- Operating system design. Processes, files, devices modeled as objects.
- Scientific and engineering
This document discusses object-oriented programming (OOP) and its advantages over other programming paradigms. It begins with an introduction to programming paradigms including procedural, object-based, and object-oriented. The key concepts of OOP are then defined, including abstraction, encapsulation, modularity, inheritance, and polymorphism. Advantages of OOP include code reusability, ease of understanding and maintenance. Disadvantages include potential overgeneralization of classes and difficulty of proper planning and design.
Introduction to C++ : Object Oriented Technology, Advantages of OOP, Input- output in
C++, Tokens, Keywords, Identifiers, Data Types C++, Derives data types. The void data
type, Type Modifiers, Typecasting, Constant
This document provides an overview of object-oriented programming (OOP) using C++. It defines key OOP concepts like classes, objects, abstraction, encapsulation, inheritance, and polymorphism. It notes that OOP improves software development productivity and maintainability by making code modular and reusable. OOP also allows for faster development and lower costs due to code reuse. However, OOP has disadvantages like a steep learning curve and producing slower programs in some cases. The document provides examples of where OOP is commonly applied, such as user interfaces, real-time systems, and artificial intelligence.
This document provides an overview of object-oriented programming concepts and their impact. It discusses the history of OOP, which began with Simula in the 1960s. It also outlines key OOP principles like classes, objects, encapsulation, inheritance, and polymorphism. Examples are given to illustrate each concept. The document concludes that OOP is now widely used because it improves code reusability and maintainability compared to older programming models.
Intro to JAVA
Basics of Oops
Features of Oops
Applications of Oops
How to create a JAVA program
How to Edit a Java Program
Compiling a Java program
Java Class file
Run or Executing a Java program
Command line arguments
This Book helps the students who are persuing B.Sc Computer Science in Andhra Pradesh. It made for learning in easiest way. Words have used in this book are very familiar. Any one can understand the language easily. Prefer this book to learn Java.
Here are some common applications of OOP and C++:
- Operating systems like Windows and Linux use OOP principles in their design. Important components like processes, files, devices are modeled as objects.
- Graphics and game development leverage OOP well. Objects can represent game elements like characters, weapons, levels etc. Inheritance helps reduce duplication.
- Desktop applications like word processors and spreadsheets have documents as central objects composed of other objects.
- Database systems use OOP to represent tables as classes and rows as objects. Object-relational mapping is used to interface between OO languages and relational databases.
- Web development frameworks heavily use OOP. Components like HTTP requests/responses, form fields are represented
The document provides an introduction to object-oriented programming concepts. It discusses the key differences between procedural and object-oriented paradigms, including that OOP organizes a program around objects and data rather than procedures. It then defines important OOP concepts like classes, objects, encapsulation, inheritance, polymorphism and messaging passing. The document also provides a brief example of a simple Java program to demonstrate these concepts.
This document provides an introduction to object-oriented programming (OOP) using Java. It defines key OOP concepts like classes, objects, encapsulation, inheritance and polymorphism. It explains the differences between procedural and object-oriented paradigms. Popular OOP languages like Java, C++, Smalltalk are listed, with examples of how classes and objects are used to represent real-world entities like vehicles. The advantages of OOP like code reusability and modular design are also summarized.
This document provides an introduction to object oriented programming (OOP). It defines key concepts in OOP like objects, classes, encapsulation, inheritance, and polymorphism. Objects are the basic runtime entities that can represent any item to be handled in a program. Classes are user-defined data types that contain data and code to manipulate that data. Encapsulation wraps data and functions into a single unit, while inheritance allows classes to inherit properties from other classes. Polymorphism allows operations to exhibit different behaviors depending on the data type. Benefits of OOP include code reuse, easier management of complexity, and better mapping to real world problems. Promising application areas for OOP include real-time systems, simulations, databases
Unit 1 introduces the basics of object-oriented programming (OOP). OOP treats data as objects that contain both data fields (properties) and methods (behaviors). Classes are templates that are used to create objects. Some key principles of OOP include encapsulation, which binds an object's data and methods together, inheritance which allows classes to share structures and behaviors of other classes, and polymorphism which allows different classes to have similarly-named methods that work in different ways. OOP aims to make code reusable, modular, and adaptable to changing requirements compared to traditional procedural programming.
This presentation introduces object-oriented programming (OOP). It discusses the hierarchy of programming paradigms, comparing procedural programming to OOP. The need for OOP is that it models real-world things better and promotes reusability. The main components of OOP discussed are classes, objects, inheritance, polymorphism, encapsulation, and abstraction. Benefits of OOP include reusability, extensibility, and maintainability. The presentation concludes that OOP allows breaking problems into smaller pieces and facilitates upgrading systems from small to large.
Adam Grant: Transforming Work Culture Through Organizational PsychologyPrachi Shah
This presentation explores the groundbreaking work of Adam Grant, renowned organizational psychologist and bestselling author. It highlights his key theories on giving, motivation, leadership, and workplace dynamics that have revolutionized how organizations think about productivity, collaboration, and employee well-being. Ideal for students, HR professionals, and leadership enthusiasts, this deck includes insights from his major works like Give and Take, Originals, and Think Again, along with interactive elements for enhanced engagement.
Diptera: The Two-Winged Wonders, The Fly Squad: Order Diptera.pptxArshad Shaikh
Diptera, commonly known as flies, is a large and diverse order of insects that includes mosquitoes, midges, gnats, and horseflies. Characterized by a single pair of wings (hindwings are modified into balancing organs called halteres), Diptera are found in almost every environment and play important roles in ecosystems as pollinators, decomposers, and food sources. Some species, however, are significant pests and disease vectors, transmitting diseases like malaria, dengue, and Zika virus.
How to Create Quotation Templates Sequence in Odoo 18 SalesCeline George
In this slide, we’ll discuss on how to create quotation templates sequence in Odoo 18 Sales. Odoo 18 Sales offers a variety of quotation templates that can be used to create different types of sales documents.
Exploring Ocean Floor Features for Middle SchoolMarie
This 16 slide science reader is all about ocean floor features. It was made to use with middle school students.
You can download the PDF at thehomeschooldaily.com
Thanks! Marie
Human Anatomy and Physiology II Unit 3 B pharm Sem 2
Respiratory system
Anatomy of respiratory system with special reference to anatomy
of lungs, mechanism of respiration, regulation of respiration
Lung Volumes and capacities transport of respiratory gases,
artificial respiration, and resuscitation methods
Urinary system
Anatomy of urinary tract with special reference to anatomy of
kidney and nephrons, functions of kidney and urinary tract,
physiology of urine formation, micturition reflex and role of
kidneys in acid base balance, role of RAS in kidney and
disorders of kidney
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...EduSkills OECD
Deborah Nusche, Senior Analyst, OECD presents at the OECD webinar 'Trends Spotting: Strategic foresight for tomorrow’s education systems' on 5 June 2025. You can check out the webinar on the website https://oecdedutoday.com/webinars/ Other speakers included: Deborah Nusche, Senior Analyst, OECD
Sophie Howe, Future Governance Adviser at the School of International Futures, first Future Generations Commissioner for Wales (2016-2023)
Davina Marie, Interdisciplinary Lead, Queens College London
Thomas Jørgensen, Director for Policy Coordination and Foresight at European University Association
HOW YOU DOIN'?
Cool, cool, cool...
Because that's what she said after THE QUIZ CLUB OF PSGCAS' TV SHOW quiz.
Grab your popcorn and be seated.
QM: THARUN S A
BCom Accounting and Finance (2023-26)
THE QUIZ CLUB OF PSGCAS.
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecdrazelitouali
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
RE-LIVE THE EUPHORIA!!!!
The Quiz club of PSGCAS brings to you a fun-filled breezy general quiz set from numismatics to sports to pop culture.
Re-live the Euphoria!!!
QM: Eiraiezhil R K,
BA Economics (2022-25),
The Quiz club of PSGCAS
Different pricelists for different shops in odoo Point of Sale in Odoo 17Celine George
Price lists are a useful tool for managing the costs of your goods and services. This can assist you in working with other businesses effectively and maximizing your revenues. Additionally, you can provide your customers discounts by using price lists.
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptxPoojaSen20
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.
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
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).