1. The document outlines the syllabus and course content for the subject "Object Oriented Techniques Using Java".
2. It provides details of the faculty member Ram Kumar Sharma and his qualifications.
3. The course is divided into 5 units covering topics such as object oriented programming concepts, classes and objects in Java, packages, exceptions handling, concurrency, I/O streams, GUI programming, generics and collections.
Prepare the following documents and develop the software project startup, prototype
model, using software engineering methodology for at least two real time scenarios or
for the sample experiments
About
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Technical Specifications
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
Key Features
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface
• Compatible with MAFI CCR system
• Copatiable with IDM8000 CCR
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
Application
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Prepare the following documents and develop the software project startup, prototype
model, using software engineering methodology for at least two real time scenarios or
for the sample experiments
About
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Technical Specifications
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
Key Features
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface
• Compatible with MAFI CCR system
• Copatiable with IDM8000 CCR
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
Application
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Object oriented programming using java
1. Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
17-10-2023
OBJECT ORIENTED TECHNIQUES USING
JAVA(ACSE0302)
Unit: 1
Introduction
Mr Ram Kumar
Sharma
Assistant Professor
IT Department
Course Details
(B.Tech 3rd Sem /2nd Year)
1
Noida Institute of Engineering and Technology, Greater Noida
2. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 2
Brief introduction of faculty Member
Name :Ram Kumar Sharma
Designation: Assistant Professor(IT Department)
NIET, Greater Noida
Qualification:.
M. Tech (CSE) from UPTU Lucknow, in 2014.
Teaching Experience: 12.5 years
Industries Experience :-1Yr & 5 Months
Research Publication
Particulars Journals
International 17
National Nil
3. 1. Name of Subject with code, Course and Subject Teacher
2. Brief Introduction of Faculty member with Photograph
3. Evaluation Scheme
4. Subject Syllabus
5. Branch wise Applications
6. Course Objective (Point wise)
7. Course Outcomes (COs)
8. Program Outcomes only heading (POs)
9. COs and POs Mapping
10. Program Specific Outcomes (PSOs)
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 3
Table of Contents
4. 11. COs and PSOs Mapping
12. Program Educational Objectives (PEOs)
13. Result Analysis (Department Result, Subject Result and Individual Faculty Result)
14. End Semester Question Paper Templates (Offline Pattern/Online Pattern)
15. Prerequisite/ Recap
16. Brief Introduction about the Subject with videos
17. Unit Content
18. Unit Objective
19. Topic Objective/Topic Outcome
20. Lecture related to topic
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 4
Conti….
17-10-2023
17-10-2023
5. 21. Daily Quiz
22. Weekly Assignment
23 Topic Links
24 MCQ (End of Unit)
25 Glossary Questions
26 Old Question Papers (Sessional + University)
27 Expected Questions
28 Recap of Unit
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 5
Conti…
7. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
UNIT-I Introduction 8 Hours
Object Oriented Programming: Introduction and Features: Abstraction, Encapsulation, Polymorphism, and Inheritance.
Modeling Concepts: Introduction, Class Diagram and Object Diagram.
Control Statements: Decision Making, Looping and Branching, Argument Passing Mechanism: Command Line Argument
UNIT-II Basics of Java Programming 8 Hours
Class and Object: Object Reference, Constructor, Abstract Class, Interface and its uses, Defining Methods, Use of “this”
and “super” keyword, Garbage Collection and finalize () Method.
Inheritance: Introduction and Types of Inheritance in Java, Constructors in Inheritance.
Polymorphism: Introduction and Types, Overloading and Overriding.
Lambda expression: Introduction and Working with Lambda Variables.
Arrays: Introduction and its Types.
7
Syllabus
8. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
UNIT-III Packages, Exception Handling and String Handling 8 hours
Packages: Introduction and Types, Access Protection in Packages, Import and Execution of Packages.
Exception Handling, Assertions and Localizations: Introduction and Types, Exceptions vs. Errors, Handling of Exception. Finally, Throws
and Throw keyword, Multiple Catch Block, Nested Try and Finally Block. Assertions and Localizations Concepts and its working.
String Handling: Introduction and Types, Operations, Immutable String, Method of String class, String Buffer and String Builder class
UNIT-IV Concurrency in Java and I/O Stream 8 hours
Threads: Introduction and Types, Creating Threads, Thread Life-Cycle, Thread Priorities, Daemon Thread, Runnable Class,
Synchronizing Threads.
I/O Stream: Introduction and Types, Common I/O Stream Operations, Interaction with I/O Streams Classes.
Annotations: Introduction, Custom Annotations and Applying Annotations.
UNIT-V GUI Programming, Generics and Collections 8 hours
GUI Programming: Introduction and Types, Applet, Life Cycle of Applet, AWT, Components and Containers, Layout Managers and User-
Defined Layout and Event Handling.
Generics and Collections: Introduction, Using Method References, Using Wrapper Class, Using Lists, Sets, Maps and Queues, Working
with Generics.
8
Syllabus
9. 9
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Text Books:
(1) Herbert Schildt,” Java - The Complete Reference”, McGraw Hill Education 12th edition
(2) Herbert Schildt,” Java: A Beginner’s Guide”, McGraw-Hill Education 2nd edition
(3) James Rumbaugh et. al, “Object Oriented Modeling and Design”, PHI 2nd Edition
Reference Books:
(4) Cay S. Horstmann, “Core Java Volume I – Fundamentals”, Prentice Hall
(5) Joshua Bloch,” Effective Java”, Addison Wesley
(6) E Balagurusamy, “Programming with Java A Primer”, TMH, 4th edition.
Text Books
10. Java can be used :
• Data import and export.
• Cleaning data.
• Statistical analysis.
• Machine learning and Deep learning.
• Deep learning.
• Text analytics (also known as Natural Language Processing or NLP).
• Data visualization.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 10
Branch-wise Applications
11. • The objective of this course is to understand the object-oriented methodology and
its techniques to design and develop conceptual models and demonstrate the
standard concepts of object-oriented techniques modularity, I/O. and other
standard language constructs.
• The basic objective of this course is to understand the fundamental concepts of
object-oriented programming in Java language and also implement the
Multithreading concepts, GUI based application and collection framework.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 11
Course Objectives
12. After completion of this course students will be able to:
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
CO1 Identify the concepts of object oriented programming and relationships
among them needed in modeling.
CO2 Demonstrate the Java programs using OOP principles and also implement the
concepts of lambda expressions.
CO3 Implement packages with different protection level resolving namespace
collision and evaluate the error handling concepts for uninterrupted execution
of Java program.
CO4 Implement Concurrency control, I/O Streams and Annotations concepts by
using Java program.
CO5 Design and develop the GUI based application, Generics and Collections in
Java programming language to solve the real-world problem.
12
Course Outcomes
13. 17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
13
Program Outcomes
1. Engineering knowledge:
2. Problem analysis:
3. Design/development of solutions:
4.Conduct investigations of complex problems
5. Modern tool usage
6. The engineer and society
7. Environment and sustainability
8. Ethics:
9. Individual and team work
10. Communication:
11. Project management and finance
12. Life-long learning
15. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 15
Program Specific Outcomes
On successful completion of graduation degree the Engineering graduates will be
able to:
PSO1: The ability to identify, analyze real world problems and design their ethical
solutions using artificial intelligence, robotics, virtual/augmented reality, data analytics,
block chain technology, and cloud computing.
PSO2:The ability to design and develop the hardware sensor devices and related
interfacing software systems for solving complex engineering problems.
PSO3:The ability to understand inter disciplinary computing techniques and to apply
them in the design of advanced computing.
PSO4: The ability to conduct investigation of complex problem with the help of
technical, managerial, leadership qualities, and moder engineering tools provided by
industry sponsored laboratories.
17. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 17
Program Educational Objectives
PEO1: To have an excellent scientific and engineering breadth so as to comprehend,
analyze, design and provide sustainable solutions for real-life problems using state-
of-the-art technologies.
PEO2:To have a successful career in industries, to pursue higher studies or to
support entrepreneurial endeavors and to face global challenges.
PEO3:To have an effective communication skills, professional attitude, ethical
values and a desire to learn specific knowledge in emerging trends, technologies for
research, innovation and product development and contribution to society.
PEO4: To have life-long learning for up-skilling and re-skilling for successful
professional career as engineer, scientist, entrepreneur and bureaucrat for betterment
of society
18. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 18
Result Analysis
19. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 19
End Semester Question Paper Templates (Offline Pattern/Online Pattern)
20. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 20
End Semester Question Paper Templates (Offline Pattern/Online Pattern)
21. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 21
End Semester Question Paper Templates (Offline Pattern/Online Pattern)
22. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 22
End Semester Question Paper Templates (Offline Pattern/Online Pattern)
23. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 23
End Semester Question Paper Templates (Offline Pattern/Online Pattern)
24. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 24
End Semester Question Paper Templates (Offline Pattern/Online Pattern)
25. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 25
End Semester Question Paper Templates (Offline Pattern/Online Pattern)
26. • Student must know at least the basics of how to use a computer, and should be
able to start a command line shell.
• Knowledge of basic programming concepts, as covered in ‘Programming Basic'
course is necessary.
• Students must have basic understanding of computer programming and related
programming paradigms
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 26
Prerequisite/Recap
27. 17-10-2023
Link:
Unit 1 https://www.youtube.com/watch?v=r59xYe3Vyks&list=PLS1QulWo1RIbfTjQvTdj8Y6yyq4R7g-Al
Unit 2 https://www.youtube.com/watch?v=ZHLdVRXIuC8&list=PLS1QulWo1RIbfTjQvTdj8Y6yyq4R7g-
Al&index=18
Unit 3 https://www.youtube.com/watch?v=hBh_CC5y8-s
Unit 4 https://www.youtube.com/watch?v=qQVqfvs3p48
Unit 5 https://www.youtube.com/watch?v=2qWPpgALJyw
• OOTS refers to languages that uses objects in programming.
• OOTS aims to implement real-world entities like inheritance, hiding, polymorphism etc in
programming.
• The main aim of OOTS is to bind together the data and the functions that operate on them
so that no other part of the code can access this data except that function
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 27
About the Subject with videos
28. • Object Oriented Programming
• Introduction and Features
• Abstraction
• Encapsulation
• Polymorphism
• Inheritance.
• Modeling Concepts
• Class Diagram
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 28
Unit Contents
29. • Object Diagram.
• Control Statements
• Decision Making
• Looping
• Branching
• Argument Passing Mechanism
• Command Line Argument.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 29
Unit Contents(Cont.)
30. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 30
•The Objective of this unit to understand the concept of OOPs.
•The Objective of this unit to understand the modeling concept and control
statements.
Unit Objectives
31. After you have read and studied this topic, you should be able to
• To learn the Object Oriented Concepts in Java.
• To learn the concept of how to initialize object in memory.
• To Understand the features of OOPs.
• To learn the concepts of code reusability and Polymorphism .
• To explore the knowledge of Control Statements.
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
31
Topic Objectives
32. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 32
Topic mapping with CO
Topic CO
Object Oriented Programming CO1
Introduction and Features CO1
Abstraction CO1
Encapsulation CO1
Polymorphism CO1
Inheritance. CO1
Modeling Concepts CO1
Class Diagram CO1
Object Diagram. CO1
Control Statements CO1
Decision Making CO1
33. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 33
Topic mapping with CO
Topic CO
Looping CO1
Branching CO1
Argument Passing Mechanism CO1
Command Line Argument. CO1
34. Lecture 1
• Object Oriented Programming
• Introduction and Features
• Procedural Vs Object Oriented Programming
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 34
35. Why Do We Need Object‐Oriented Programming?
• Object‐Oriented Programming was developed because limitations were discovered i
n earlier approaches to programming.
• To appreciate what OOP does, we need to understand what these limitations are and
how they arose from traditional programming languages.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 35
Object Oriented Programming
36. Procedure‐Oriented Programming
• C, Pascal, FORTRAN, and similar languages are procedural languages.
• Each statement in the language tells the computer to do something:
– get some input
– add these numbers
– divide by 6
– display that output
• A program in a procedural language is a list of instructions.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 36
Object Oriented Programming
37. • Challenges in developing a business application.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
• If these challenges are not addressed, it may lead to software crisis.
37
Need for OOPApproach
38. Procedure‐Oriented Programming
Procedural program is divided into functions
•Each function has a clearly defined purpose and a clearly defined interface to the other functions
in the program.
•The idea of breaking a program into functions can be further extended by grouping a number of
functions together into a larger entity called a module.
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
38
Procedure-Oriented Programming
39. Procedure‐Oriented Programming Drawbacks:
• Since every function has complete access to the global variables, the new programmer can
corrupt the data accidentally by creating function.
• We can access the data of one function from other since, there is no protection.
• In large program it is very difficult to identify what data is used by which function.
• Similarly, if new data is to be added, all the function needed to be modified to access the data.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 39
Procedure Oriented Programming (Cont.)
40. 17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
Procedural Oriented Programming Object Oriented Programming
In procedural programming, program is divided into small parts
called functions.
In object oriented programming, program is divided into small
parts called objects.
Procedural programming follows top down approach. Object oriented programming follows bottom up approach.
There is no access specifier in procedural programming.
Object oriented programming have access specifiers like private,
public, protected etc.
Adding new data and function is not easy. Adding new data and function is easy.
Procedural programming does not have any proper way for hiding
data so it is less secure.
Object oriented programming provides data hiding so it is more
secure.
In procedural programming, overloading is not possible. Overloading is possible in object oriented programming.
In procedural programming, function is more important than data.
In object oriented programming, data is more important than
function.
Procedural programming is based on unreal world. Object oriented programming is based on real world.
Examples: C, FORTRAN, Pascal, Basic etc. Examples: C++, Java, Python, C# etc.
40
Procedure Oriented Programming Vs Object Oriented
Programming
42. • The main aim of OOP is to bind together the data and the functions that operate on
them so that no other part of the code can access this data except that function.
• In the object oriented paradigm, the list and the associated operations are treated as
one entity known as an object.
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
42
Object Oriented Programming
43. The striking features of OOP include the following:
• The programs are data centered.
• Programs are divided in terms of objects and not procedures.
• Functions that operate on data are tied together with the data.
• Data is hidden and not accessible by external functions.
• New data and functions can be easily added as and when required.
• Follows a bottom-up approach for problem solving.
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
43
Object Oriented Programming
44. OOP was introduced to overcome flaws in the procedural approach to programming.
• Such as lack of reusability & maintainability.
•Fundamental idea behind object‐oriented languages is to combine into a single unit both
data and the functions that operate on that data.
• Such a unit is called an object.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 44
Object Oriented Programming
45. • In OOP, problem is divided into the number of entities called objects
and then builds data and functions around these objects.
• It ties the data more closely to the functions that operate on it, and protects it from accidental
modification from the outside functions.
• Data of an object can be accessed only by the functions associated with that object.
• Communication of the objects done through function.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 45
Object Oriented Programming
46. Object means a real-world entity such as a pen, chair, table, computer, watch, etc. Object-
Oriented Programming is a methodology or paradigm to design a program using classes and
objects.
It simplifies software development and maintenance by providing some concepts:
•Object
•Class
•Inheritance
•Polymorphism
•Abstraction
•Encapsulation
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 46
Object Oriented Programming
47. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 47
Pillars of OOPs
48. • Binding the data with the code that manipulates it.
• It keeps the data and the code safe from external interference
Example :-
• A power steering mechanism of a car. Power steering of a car is a complex system, which
internally have lots of components tightly coupled together, they work synchronously to turn
the car in the desired direction. It even controls the power delivered by the engine to the
steering wheel. But to the external world there is only one interface is available and rest of the
complexity is hidden. Moreover, the steering unit in itself is complete and independent. It does
not affect the functioning of any other mechanism.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 48
Encapsulation
50. • Abstraction is a process of hiding the implementation details from the user, only the
functionality will be provided to the user. In other words, the user will have the information on
what the object does instead of how it does.
• Example 1, when you login to your Amazon account online, you enter your user_id and
password and press login, what happens when you press login, how the input data sent to
amazon server, how it gets verified is all abstracted away from the you.
• Example 2: A car in itself is a well-defined object, which is composed of several other smaller
objects like a gearing system, steering mechanism, engine, which are again have their own
subsystems. But for humans car is a one single object, which can be managed by the help of
its subsystems, even if their inner details are unknown.
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
50
Abstraction
53. • The mechanism of deriving a new class from an old one (existing class) such that
the new class inherit all the members (variables and methods) of old class is
called inheritance or derivation.
• A class that is derived from another class is called a subclass (also a derived
class, extended class or child class)
• The class from which the subclass is derived is called a super class or base class
or parent class
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 53
Inheritance
54. The old class is referred to as the Super class and the new one is called the Sub
class.
• Parent Class - Base Class or Super Class
• Child Class - Derived Class or Sub Class
Parent Class
Child Class
Father
• Home
• Money
• Business
Son
• BMW
• Job
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 54
Inheritance
55. For example:
• Car is a four wheeler vehicle so assume that we have a class FourWheeler and a sub class of it
named Car. Here Car acquires the properties of a class FourWheeler. Other classifications could be
a jeep, van etc.
• FourWheeler defines a class of vehicles that have four wheels, and specific range of engine power,
load carrying capacity etc.
• Car (termed as a sub-class) acquires these properties from FourWheeler, and has some specific
properties, which are different from other classifications of FourWheeler, such as luxury, comfort,
shape, size, usage etc.
• A car can have further classification such as an open car, small car, big car etc, which will acquire
the properties from both Four Wheeler and Car, but will still have some specific properties.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 55
Inheritance
56. Inheritance has a lot of benefits :
• Extensibility
• Reusability
• Provide abstraction
• Eliminates redundant code
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 56
Advantages of Inheritance
57. 1. class Employee{
2. float salary=40000;
3. }
4. class Programmer extends Employee{
5. int bonus=10000;
6. public static void main(String args[]){
7. Programmer p=new Programmer();
8. System.out.println("Programmer salary is:"+p.salary);
9. System.out.println("Bonus of Programmer is:"+p.bonus);
10.}
11.}
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 57
Inheritance Example
58. • Polymorphism is a word that came from two greek words, poly means many and morphos means forms.
• If a variable, object or method perform different behavior according to situation, it is called polymorphism.
Example of a car
• A car have a gear transmission system. It has four front gears and one backward gear. When the engine is
accelerated then depending upon which gear is engaged different amount power and movement is delivered
to the car. The action is same applying gear but based on the type of gear the action behaves differently or
you can say that it shows many forms (polymorphism means many forms)
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
58
Polymorphism
61. • Object-oriented modeling and design is a way of thinking about problems using models
organized around real world concepts.
• The fundamental construct is the object, which combines both data structure and
behavior.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 61
Modeling Concepts
62. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
What is Modeling?
•Modeling consists of building an abstraction of reality.
•Abstractions are simplifications because:
• They ignore irrelevant details and
• They only represent the relevant details.
•What is relevant or irrelevant depends on the purpose of the model.
62
Modeling Concepts
63. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
What is a Model
•A model is a simplification of reality.
•A model may provide
•blueprints of a system
•Organization of the system
•Dynamic of the system
63
Modeling Concepts
64. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
MODEL
•A model is an abstraction, before building any system a prototype may be
developed. The main purpose of model is for understanding of the system.
•Designer build different kinds of models for various purposes before constructing
things.
•For example car , airplane, blueprints of machine parts, Plan for house construction
etc., Models serve many purposes
64
Modeling Concepts cont….
68. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Importance of Modeling
•Models help us
• to visualize a system as it is or as we want it to be.
• to specify the structure or behavior of a system.
• in providing a template that guides us in constructing a system.
• in providing documenting the decisions we have made.
68
Modeling Concepts
69. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Purpose of Modeling
Designers build many kinds of models for various purposes before constructing
things.
Models serve several purposes –
• Testing a physical entity before building (simulation)
• Communication with customer
• Visualization
• Reduction of complexity
• Better understanding of the problem
69
Modeling Concepts
70. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Purpose of Modeling
Communication with customers
•Architects and product designers build models to show their customers.
•Mock ups are demonstration products that imitate some or all of the external behavior of a
system.
70
Modeling Concepts
71. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Visualization
Storyboards of movies, television shows and advertisements let writers see how their ideas flow.
They can modify awkward transitions, and unnecessary segments before detailed writing begins.
Reduction of complexity
The main reason for modeling is to deal with systems that are too complex to understand directly.
Models reduce complexity by separating out a small number of important things to deal with at a
time.
71
Modeling Concepts
72. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Reduction of complexity
The main reason for modeling is to deal with systems that are too complex to understand
directly. Models reduce complexity by separating out a small number of important things to
deal with at a time.
72
Modeling Concepts
73. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
UML
UML (Unified Modeling Language) is a general-purpose, graphical modeling language in the field
of Software Engineering. UML is used to specify, visualize, construct, and document the artifacts
(major elements) of the software system.
UML is composed of three main building blocks, i.e., things, relationships, and diagrams. Building
blocks generate one complete UML model diagram by rotating around several different blocks. It
plays an essential role in developing UML diagrams. The basic UML building blocks are enlisted
below:
1.Things
2.Relationships
3.Diagrams
73
Modeling Concepts: UML
76. • Class diagram is a static diagram. It represents the static view of an application.
• Class diagram is not only used for visualizing, describing, and documenting different aspects of
a system but also for constructing executable code of the software application.
• It is the only diagram that is widely used for construction, and it can be mapped with object-
oriented languages.
Following are the purpose of class diagrams given below:
• It analyses and designs a static view of an application.
• It describes the major responsibilities of a system.
• It is a base for component and deployment diagrams.
• It incorporates forward and reverse engineering.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 76
Class Diagram
77. ClassName
attributes
operations
A class is a description of a set of objects that share the
same attributes, operations, relationships, and semantics.
Graphically, a class is rendered as a rectangle, usually
including its name, attributes, and operations in separate,
designated compartments.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 77
Class Diagram(Cont.)
78. ClassName
attributes
operations
The name of the class is the only required tag in the
graphical representation of a class. It always appears in
the top-most compartment.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 78
Class Diagram(Cont.)
79. Person
name : String address
:
Address birthdate : Date
ssn : Id
An attribute is a named property of a class that describes
the object being modeled.
In the class diagram, attributes appear in the second
compartment just below the name-compartment.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 79
Class Diagram(Cont.)
80. Person
name : String
address :
Address birthdate :
Date ssn
: Id
eat sleep work play
Operations describe the class behavior
and appear in the third compartment.
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
80
Class Diagram(Cont.)
81. An example of Class
Account_Name
- Custom_Name
- Balance
+AddFunds( )
+WithDraw( )
+Transfer( )
Name
Attributes
Operations
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 81
Class Diagram(Cont.)
82. Attributes
• An attribute is a named property of a class that describes a range of values that
instances of the property may hold.
• A class may have any number of attributes or no attributes at all.
• An attribute represents some property of the thing you are modeling that is shared
by all objects of that class.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 82
Class Diagram(Cont.)
83. • The following diagram is an example of an Order System of an application. It
describes a particular aspect of the entire application.
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
83
Class Diagram(Cont.)
84. Relationships
In UML, relationships are of three types:
Dependency:
A dependency is a semantic relationship between two or more classes where a change
in one class cause changes in another class. It forms a weaker relationship.
In the following example, Student_Name is dependent on the Student_Id.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 84
Relationships in Class Diagram
85. Generalization:
A generalization is a relationship between a parent class (superclass) and a child class
(subclass). In this, the child class is inherited from the parent class.
For example, The Current Account, Saving Account, and Credit Account are the
generalized form of Bank Account.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 85
Relationships in Class Diagram(Cont.)
86. Association:
It describes a static or physical connection between two or more objects. It depicts how many
objects are there in the relationship.
For example, a department is associated with the college.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 86
Relationships in Class Diagram(Cont.)
87. Multiplicity:
It defines a specific range of allowable instances of attributes. In case if a range is
not specified, one is considered as a default multiplicity.
For example, multiple patients are admitted to one hospital.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 87
Relationships in Class Diagram(Cont.)
88. Aggregation:
An aggregation is a subset of association, which represents has a relationship. It is more
specific then association. It defines a part-whole or part-of relationship. In this kind of
relationship, the child class can exist independently of its parent class.
The company encompasses a number of employees, and even if one employee resigns, the
company still exists.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 88
Relationships in Class Diagram(Cont.)
89. Composition:
The composition is a subset of aggregation. It portrays the dependency between the parent
and its child, which means if one part is deleted, then the other part also gets discarded. It
represents a whole-part relationship.
A contact book consists of multiple contacts, and if you delete the contact book, all the
contacts will be lost.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 89
Relationships in Class Diagram(Cont.)
90. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Class Visibility
The +, - and # symbols before an attribute and operation name in a class denote the visibility of the
attribute and operation.
•+ denotes public attributes or operations
•- denotes private attributes or operations
•# denotes protected attributes or operations
90
Class Diagram(Cont.)
91. How to draw a Class Diagram?
The class diagram is used most widely to construct software applications. It not only represents a
static view of the system but also all the major aspects of an application. A collection of class
diagrams as a whole represents a system.
Some key points that are needed to keep in mind while drawing a class diagram are given below:
1. To describe a complete aspect of the system, it is suggested to give a meaningful name to the
class diagram.
2. The objects and their relationships should be acknowledged in advance.
3. The attributes and methods (responsibilities) of each class must be known.
4. A minimum number of desired properties should be specified as more number of the unwanted
property will lead to a complex diagram.
5. Notes can be used as and when required by the developer to describe the aspects of a diagram.
6. The diagrams should be redrawn and reworked as many times to make it correct before
producing its final version.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 91
Class Diagram(Cont.)
92. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 92
Class Diagram (Example)
93. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 93
Class Diagram(Example)
94. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 94
Class Diagram(Example)
95. The following points should be remembered while drawing a class diagram −
• The name of the class diagram should be meaningful to describe the aspect of the system.
• Each element and their relationships should be identified in advance.
• Responsibility (attributes and methods) of each class should be clearly identified
• For each class, minimum number of properties should be specified, as unnecessary properties will make the
diagram complicated.
• Use notes whenever required to describe some aspect of the diagram. At the end of the drawing it should be
understandable to the developer/coder.
• Finally, before making the final version, the diagram should be drawn on plain paper and reworked as many
times as possible to make it correct.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 95
Class Diagram
96. Object
• An object is a concept, abstraction, or thing with identity that has meaning for
an application.
• Objects often appear as proper nouns or specific references in problem
descriptions and discussions with users.
• Some objects have real-world entity like table, tree
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 96
Object Diagram
97. Attribute and Value of an object
• Each attribute is associated a specific value.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 97
Object Diagram
98. • Object diagrams are derived from class diagrams so object diagrams are
dependent upon class diagrams.
• Object diagrams also represent the static view of a system but this static view is a
snapshot of the system at a particular moment.
The purpose of the object diagram can be summarized as
• Forward and reverse engineering.
• Object relationships of a system
• Static view of an interaction.
• Understand object behavior and their relationship from practical perspective
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 98
Object Diagram
99. The following things should be remembered and understood clearly −
• Object diagrams consist of objects.
• The link in object diagram is used to connect objects.
• Objects and links are the two elements used to construct an object diagram.
• The object diagram should have a meaningful name to indicate its purpose.
• The most important elements are to be identified.
• The association among objects should be clarified.
• Values of different elements need to be captured to include in the object diagram.
• Add proper notes at points where more clarity is required.
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
99
Object Diagram
100. • The following diagram is an example of an object diagram. It represents the
Order management system
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 100
Object Diagram
101. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Serial No. Class Diagram Object Diagram
1. It depicts the static view of a
system.
It portrays the real-time behavior of a
system.
2. Dynamic changes are not included
in the class diagram.
Dynamic changes are captured in the object
diagram.
3. The data values and attributes of an
instance are not involved here.
It incorporates data values and attributes of
an entity.
4. The object behavior is manipulated
in the class diagram.
Objects are the instances of a class.
101
Object Diagram Vs Class Diagram
102. Lecture 5
• Control Statements
• Decision Making
• Looping
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 102
103. • Java compiler executes the code from top to bottom.
• The statements in the code are executed according to the order in which they appear.
However, java provides statements that can be used to control the flow of Java code.
Such statements are called control flow statements.
• Java provides three types of control flow statements:
I. Decision Making statements
II. Loop statements
III.Jump statements
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 103
Control Statements
104. • Decision-making statements decide which statement to execute and when.
• Decision-making statements evaluate the Boolean expression and control the
program flow depending upon the result of the condition provided.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 104
Decision Making Statements
105. 1.If Statement:
• In Java, the "if" statement is used to evaluate a condition. The control of the
program is diverted depending upon the specific condition.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 105
Decision Making Statements
106. 1.If Statement:
• In Java, the "if" statement is used to evaluate a condition. The control of the program is diverted depending upon
the specific condition.
1. //Java Program to demonstate the use of if statement.
2. public class IfExample {
3. public static void main(String[] args) {
4. //defining an 'age' variable
5. int age=20;
6. //checking the age
7. if(age>18){
8. System.out.print("Age is greater than 18");
9. }
10.}
11.}
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 106
Decision Making Statements
107. If-else:
• We can use the else statement with if statement to execute a block of code when
the condition is false.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 107
Decision Making Statements
108. If-else:
• We can use the else statement with if statement to execute a block of code when the condition is false.
1. public class IfElseExample {
2. public static void main(String[] args) {
3. //defining a variable
4. int number=13;
5. //Check if the number is divisible by 2 or not
6. if(number%2==0){
7. System.out.println("even number");
8. }else{
9. System.out.println("odd number");
10. }
11. }
12. }
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 108
Decision Making Statements
109. Nested-if:
A nested if is an if statement that is the target of another if or else. Nested if
statements means an if statement inside an if statement.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 109
Decision Making Statements
110. 17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
1.//Java Program to demonstrate the use of Nested If Statement.
2.public class JavaNestedIfExample {
3.public static void main(String[] args) {
4. //Creating two variables for age and weight
5. int age=20;
6. int weight=80;
7. //applying condition on age and weight
8. if(age>=18){
9. if(weight>50){
10. System.out.println("You are eligible to donate blood");
11. }
12. }
13.}}
110
Decision Making Statements
111. if-else-if-ladder:
• if statements are executed from the top down.
• As soon as one of the conditions controlling the if is true, the statement
associated with that if is executed, and the rest of the ladder is bypassed.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 111
Decision Making Statements
113. switch statement
The switch statement is a multiway branch statement. It provides an easy way to
dispatch execution to different parts of code based on the value of the expression.
Syntax:
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 113
Decision Making Statements
114. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
1.public class SwitchExample {
2.public static void main(String[] args) {
3. //Declaring a variable for switch expression
4. int number=20;
5. //Switch expression
6. switch(number){
7. //Case statements
8. case 10: System.out.println("10");
9. break;
10. case 20: System.out.println("20");
11. break;
12. case 30: System.out.println("30");
13. break;
14. //Default case statement
15. default:System.out.println("Not in 10, 20 or 30");
16. }
17.}
18.}
114
Decision Making Statements
115. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Example:
1. Finding Month
2. Program to check Vowel or Consonant:
115
Decision Making Statements
116. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Switch Statement is fall-through
The Java switch statement is fall-through. It means it executes all statements after the first match if
a break statement is not present.
Java Switch Statement with String
Java allows us to use strings in switch expression since Java SE 7. The case statement should be
string literal.
Java Nested Switch Statement
We can use switch statement inside other switch statement in Java. It is known as nested switch
statement.
Java Enum in Switch Statement
Java allows us to use enum in switch statement. Java enum is a class that represent the group of
constants. (immutable such as final variables). We use the keyword enum and put the constants in
curly braces separated by comma
116
Decision Making Statements
117. Loops in Java
The Java for loop is used to iterate a part of the program several times. If the
number of iteration is fixed, it is recommended to use for loop.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 117
Looping
118. for loop:
• for loop provides a concise way of writing the loop structure.
• Unlike a while loop, a for statement consumes the initialization, condition and
increment/decrement in one line thereby providing a shorter, easy to debug
structure of looping.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 118
Looping
119. • Initialization condition: Here, we initialize the variable in use. It marks the start of a for loop. An
already declared variable can be used or a variable can be declared, local to loop only.
• Testing Condition: It is used for testing the exit condition for a loop. It must return a boolean
value. It is also an Entry Control Loop as the condition is checked prior to the execution of the
loop statements.
• Statement execution: Once the condition is evaluated to true, the statements in the loop body are
executed.
• Increment/ Decrement: It is used for updating the variable for next iteration.
• Loop termination:When the condition becomes false, the loop terminates marking the end of its
life cycle.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 119
Looping
120. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
1.//Java Program to demonstrate the example of for loop
2.//which prints table of 1
3.public class ForExample {
4.public static void main(String[] args) {
5. //Code of Java for loop
6. for(int i=1;i<=10;i++){
7. System.out.println(i);
8. }
9.}
10.}
120
Looping
121. Java Nested for Loop
If we have a for loop inside the another loop, it is known as nested for loop. The inner loop
executes completely whenever outer loop executes.
1. public class NestedForExample {
2. public static void main(String[] args) {
3. //loop of i
4. for(int i=1;i<=3;i++){
5. //loop of j
6. for(int j=1;j<=3;j++){
7. System.out.println(i+" "+j);
8. }//end of i
9. }//end of j
10.}
11.}
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 121
Looping
122. Java for-each Loop
• The for-each loop is used to traverse array or collection in Java. It is easier to use than simple for loop
because we don't need to increment value and use subscript notation.
• It works on the basis of elements and not the index. It returns element one by one in the defined
variable.
Syntax:
for(data_type variable : array_name){
//code to be executed
}
1. public class ForEachExample {
2. public static void main(String[] args) {
3. //Declaring an array
4. int arr[]={12,23,44,56,78};
5. //Printing array using for-each loop
6. for(int i:arr){
7. System.out.println(i);
8. }
9. }
10. }
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 122
Looping
123. Java Labeled For Loop
• We can have a name of each Java for loop. To do so, we use label before the for
loop. It is useful while using the nested for loop as we can break/continue specific
for loop.
Syntax:
labelname:
for(initialization; condition; increment/decrement){
}
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
123
Looping
124. 1. public class LabeledForExample {
2. public static void main(String[] args) {
3. //Using Label for outer and for loop
4. aa:
5. for(int i=1;i<=3;i++){
6. bb:
7. for(int j=1;j<=3;j++){
8. if(i==2&&j==2){
9. break aa;
10. }
11. System.out.println(i+" "+j);
12. }
13. }
14.}
15.}
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 124
Looping
125. While loop:
• A while loop is a control flow statement that allows code to be executed repeatedly based
on a given Boolean condition. The while loop can be thought of as a repeating if
statement.
• While loop starts with the checking of condition. If it evaluated to true, then the loop
body statements are executed otherwise first statement following the loop is executed.
For this reason it is also called Entry control loop
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 125
Looping
127. Do-while:
• do while loop is similar to while loop with only difference that it checks for condition
after executing the statements, and therefore is an example of Exit Control Loop.
• do while loop starts with the execution of the statement(s). There is no checking of any
condition for the first time.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 127
Looping
129. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Comparison for loop while loop do-while loop
Introduction The Java for loop is a control flow
statement that iterates a part of
the programs multiple times.
The Java while loop is a control flow
statement that executes a part of the
programs repeatedly on the basis of
given boolean condition.
The Java do while loop is a control
flow statement that executes a part of
the programs at least once and the
further execution depends upon the
given boolean condition.
When to use If the number of iteration is fixed, it is
recommended to use for loop.
If the number of iteration is not fixed,
it is recommended to use while loop.
If the number of iteration is not fixed
and you must have to execute the loop
at least once, it is recommended to use
the do-while loop.
Syntax for(init;condition;incr/decr){
// code to be executed
}
while(condition){
//code to be executed
}
do{
//code to be executed
}while(condition);
Example //for loop
for(int i=1;i<=10;i++){
System.out.println(i);
}
//while loop
int i=1;
while(i<=10){
System.out.println(i);
i++;
}
//do-while loop
int i=1;
do{
System.out.println(i);
i++;
}while(i<=10);
Syntax for infinitive loop for(;;){
//code to be executed
}
while(true){
//code to be executed
}
do{
//code to be executed
}while(true);
129
Looping Comparison
130. Lecture 6
• Control Statements
• Decision Making
• Looping
• Branching
• Argument Passing Mechanism
• Command Line Argument.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 130
131. • Branching statements are the statements used to jump the flow of execution
from one part of a program to another.
• The branching statements are mostly used inside the control statements.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 131
Branching Statements
132. The break Statement
• Using break, we can force immediate termination of a loop, bypassing the conditional
expression and any remaining code in the body of the loop.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 132
Branching Statements
133. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Break Statement
When a break statement is encountered inside a loop, the loop is immediately terminated
and the program control resumes at the next statement following the loop.
The Java break statement is used to break loop or switch statement. It breaks the current
flow of the program at specified condition. In case of inner loop, it breaks only inner
loop.
We can use Java break statement in all types of loops such as for loop, while loop and do-
while loop.
Syntax:
1.jump-statement;
2.break;
133
Branching Statements
134. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
1.//Java Program to demonstrate the use of break statement
2.//inside the for loop.
3.public class BreakExample {
4.public static void main(String[] args) {
5. //using for loop
6. for(int i=1;i<=10;i++){
7. if(i==5){
8. //breaking the loop
9. break;
10. }
11. System.out.println(i);
12. }
13.}
14.}
134
Branching Statements
135. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Break Statement with Labeled For Loop
We can use break statement with a label. The feature is introduced since JDK 1.5. So, we
can break any loop in Java now whether it is outer or inner loop.
1.public class BreakExample3 {
2.public static void main(String[] args) {
3. aa:
4. for(int i=1;i<=3;i++){
5. bb:
6. for(int j=1;j<=3;j++){
7. if(i==2&&j==2){
8. break aa;
9. }
10. System.out.println(i+" "+j);
11. }
12. }
13.} }
135
Branching Statements
136. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Break Statement in while loop
1.public class BreakWhileExample {
2.public static void main(String[] args) {
3. //while loop
4. int i=1;
5. while(i<=10){
6. if(i==5){
7. //using break statement
8. i++;
9. break;//it will break the loop
10. }
11. System.out.println(i);
12. i++;
13. }
14.}
15.}
136
Branching Statements
137. 17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Break Statement in do-while loop
1.public class BreakDoWhileExample {
2.public static void main(String[] args) {
3. int i=1;
4. do{
5. if(i==5){
6. //using break statement
7. i++;
8. break;//it will break the loop
9. }
10. System.out.println(i);
11. i++;
12. }while(i<=10);
13.}
14.}
137
Branching Statements
138. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Break Statement with Switch
To understand the example of break with switch statement, please visit Switch slide.
1.switch(expression){
2.case value1:
3. //code to be executed;
4. break; //optional
5.case value2:
6. //code to be executed;
7. break; //optional
8.......
9.
10.default:
11. code to be executed if all cases are not matched;
12.}
138
Conti..
139. Continue:
• Sometimes it is useful to force an early iteration of a loop. That is, you might
want to continue running the loop but stop processing the remainder of the code
in its body for this particular iteration.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 139
Branching Statements
140. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Continue Statement
The continue statement is used in loop control structure when you need to jump to the next iteration
of the loop immediately. It can be used with for loop or while loop.
The Java continue statement is used to continue the loop. It continues the current flow of the
program and skips the remaining code at the specified condition. In case of an inner loop, it
continues the inner loop only.
We can use Java continue statement in all types of loops such as for loop, while loop and do-while
loop.
Syntax:
1.jump-statement;
2.continue;
140
Branching Statements
141. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
1.//Java Program to demonstrate the use of continue statement
2.//inside the for loop.
3.public class ContinueExample {
4.public static void main(String[] args) {
5. //for loop
6. for(int i=1;i<=10;i++){
7. if(i==5){
8. //using continue statement
9. continue;//it will skip the rest statement
10. }
11. System.out.println(i);
12. }
13.}
14.}
141
Branching Statements
142. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Continue Statement with Inner Loop
It continues inner loop only if you use the continue statement inside the inner loop.
1. public class ContinueExample2 {
2.public static void main(String[] args) {
3. //outer loop
4. for(int i=1;i<=3;i++){
5. //inner loop
6. for(int j=1;j<=3;j++){
7. if(i==2&&j==2){
8. continue;
9. }
10. System.out.println(i+" "+j);
11. }
12. }
13.}
14.}
142
Branching Statements
143. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Continue Statement with Labelled For Loop
We can use continue statement with a label. This feature is introduced since JDK 1.5. So, we can
continue any loop in Java now whether it is outer loop or inner.
1.public class ContinueExample3 {
2.public static void main(String[] args) {
3. aa:
4. for(int i=1;i<=3;i++){
5. bb:
6. for(int j=1;j<=3;j++){
7. if(i==2&&j==2){
8. continue aa;
9. }
10. System.out.println(i+" "+j);
11. }
12. }
13.}
14.}
143
Conti………..
144. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Continue Statement in while loop
1.public class ContinueWhileExample {
2.public static void main(String[] args) {
3. int i=1;
4. while(i<=10){
5. if(i==5){
6. i++;
7. continue;//it will skip the rest statement
8. }
9. System.out.println(i);
10. i++;
11. }
12.}
13.}
144
Branching Statements
145. 17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Continue Statement in do-while Loop
1.public class ContinueDoWhileExample {
2.public static void main(String[] args) {
3. //declaring variable
4. int i=1;
5. do{
6. if(i==5){
7. i++;
8. continue;//it will skip the rest statement
9. }
10. System.out.println(i);
11. i++;
12. }while(i<=10);
13.}
14.}
145
Branching Statements
146. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Java Continue Statement in do-while Loop
1.public class ContinueDoWhileExample {
2.public static void main(String[] args) {
3. //declaring variable
4. int i=1;
5. do{
6. if(i==5){
7. i++;
8. continue;//it will skip the rest statement
9. }
10. System.out.println(i);
11. i++;
12. }while(i<=10);
13.}
14.}
146
Branching Statements
147. 17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
BASIS FOR COMPARISON BREAK CONTINUE
Task It terminates the execution of
remaining iteration of the loop.
It terminates only the current
iteration of the loop.
Control after break/continue 'break' resumes the control of
the program to the end of loop
enclosing that 'break'.
'continue' resumes the control
of the program to the next
iteration of that loop enclosing
'continue'.
Causes It causes early termination of
loop.
It causes early execution of the
next iteration.
Continuation 'break' stops the continuation of
loop.
'continue' do not stops the
continuation of loop, it only
stops the current iteration.
Other uses 'break' can be used with
'switch', 'label'.
'continue' can not be executed
with 'switch' and 'labels'.
147
Break vs Conti…..
148. Return:
• The return statement is used to explicitly return from a method. That is, it
causes a program control to transfer back to the caller of the method.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 148
Branching Statements
149. • Arguments in Java are always passed-by-value.
• During method invocation, a copy of each argument, whether its a value or
reference, is created in stack memory which is then passed to the method.
• When we pass an object, the reference in stack memory is copied and the new
reference is passed to the method.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 149
Argument Passing Mechanism
150. • Command line argument is a parameter supplied to the program when it is invoked.
• Command line argument is an important concept in programming.
• It is mostly used when you need to control your program from outside.
• Command line arguments are passed to the main() method.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 150
Command Line Argument
151. To pass command line arguments, we typically define main() with two arguments : first argument is
the number of command line arguments and second is list of command-line arguments.
int main(int argc, char *argv[]) { /* ... */ }
• argc (ARGument Count) is int and stores number of command-line arguments passed by the
user including the name of the program. So if we pass a value to a program, value of argc would
be 2 (one for argument and one for program name).The value of argc should be non negative.
• argv(ARGument Vector) is array of character pointers listing all the arguments.
• If argc is greater than zero,the array elements from argv[0] to argv[argc-1] will contain pointers to
strings.
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 151
Command Line Argument
152. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
1.class CommandLineExample{
2.public static void main(String args[]){
3.System.out.println("Your first argument is: "+args[0]);
4.}
5.}
152
Conti….
153. 1. Which of the following is not OOPS concept in Java? [CO1]
a) Inheritance
b) Encapsulation
c) Polymorphism
d) Compilation
2. Which of the following is a type of polymorphism in Java?[CO1]
a) Compile time polymorphism
b) Execution time polymorphism
c) Multiple polymorphism
d) Multilevel polymorphism
3. Which concept of Java is a way of converting real world objects in terms of class?[CO1]
a) Polymorphism
b) Encapsulation
c) Abstraction
d) Inheritance
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
153
Daily Quiz
154. 4. Which of the following is not an OOPS concept?[CO1]
a. Encapsulation
b.Polymorphism
c.Exception
d.Abstraction
5. Which feature of OOPS described the reusability of code?[CO1]
a. Abstraction
b.Encapsulation
c.Polymorphism
d.Inheritance
6.Which feature of OOPS derives the class from another class?[CO1]
a. Inheritance
b.Data hiding
c.Encapsulation
d.Polymorphism
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 154
Daily Quiz
155. 7. An IF-ELSE statement is also called ___.[CO1]
a. Branching statement
b. Control statement
c. Block statements
d. All
8.Which of these jump statements can skip processing the remainder of the code in its body for a
particular iteration?[CO1]
a. Break
b.Return
c.Exit
d.continue
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING
JAVA
155
Daily Quiz
156. 9. Every loop in Java has a condition that should be ___ in order to proceed for execution. [CO1]
A) FALSE
B) TRUE
10. What is a Loop in Java programming language?[CO1]
A) A Loop is a block of code that is executed repeatedly as long as a condition is satisfied.
B) A Loop is a block of code that is executed only once if the condition is satisfied.
C) A Loop is a block of code that is executed more than 2 times if the condition is satisfied.
D) None
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 156
Daily Quiz
157. 17-10-2023
Q1. State some of object oriented technique strategies.[CO1]
Q2.Draw the class diagram of Online Shopping System.[CO1]
Q3.Discuss Inheritance and polymorphism with Example.[CO1]
Q4.Differentiate between Break and Continue statement.[CO1]
Q5.Describe Object Diagram with suitable example.[CO1]
Q6.Define if-else-if ladder with short program.[CO1]
Q7.Describe the control flow statement and types of control flow statements.[CO1]
Q8.Explain branching statements in Java with suitable examples.[CO1]
Q9. Explain Encapsulation with example.[CO1]
Q10. Draw class diagram of online library management system.[CO1]
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
157
Weekly Assignment
159. 17-10-2023
1. Which of the following is not an OOP concept?[CO1]
a) Encapsulation
b) Polymorphism
c) Exception
d) Abstraction
Ans C
2. A single program of OOPS contains _______ classes?[CO1]
a) Only 1
b) Only 999
c) Only 100
d) Any number
Ans D
3. The while loop repeats a set of code while the condition is not
met?[CO1]
a)True
b) False
Ans B
4. Which of the following is used with the switch statement?[CO1]
a) Continue
b) Exit
c) break
d) do
Ans C
5. Which of the following is not a valid flow control statement?[CO1]
a) exit()
b) break
c) continue
d) return
Ans A
6. Can command line arguments be converted into int automatically if
required?[CO1]
a) Yes
b) No
Ans B
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 159
MCQs
160. Q7. Which of these are selection statements in Java?[CO1]
a) if()
b) for()
c) continue
d) break
Q8. Which of this statement is incorrect?[CO1]
a) switch statement is more efficient than a set of nested ifs
b) two case constants in the same switch can have identical values
c) switch statement can only test for equality, whereas if statement can evaluate any type of Boolean expression
d) it is possible to create a nested switch statements
Q9. Which of these selection statements test only for equality?[CO1]
a) if
b) switch
c) if & switch
d) none of the mentioned
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 160
MCQs
161. Q10. switch(x){ default: System.out.println(“Hello”); }
Which of the following is acceptable types for x? [CO1]
(i) byte and char
(ii) char and float
(iii) float and double
(iv) double and int
Q11.An IF statement in Java is also a ___ statement.[CO1]
A) Boolean
B) conditional
C) iterative
D) Optional
Q12.What is the output of the Java program with IF-ELSE statements?[CO1]
if(TRUE) System.out.println("GO"); else System.out.println("STOP");
A) GO
B) STOP
C) Compiler error
D) None
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 161
MCQs
162. Q13.What is the output of the Java program?[CO1]
int a=10; if(a==9)
System.out.println("OK ");
System.out.println("MASTER"); else System.out.println("BYE");
A) OK MASTER
B) BYE
C) Compiler error
D) None
Q14.What is the output of the Java program with IF-ELSE-IF statements?[CO1]
int marks=55; if(marks >= 80)
System.out.println("DISTINCTION");
else if(marks >=35)
System.out.println("PASS");
else
System.out.println("FAIL");
17-10-2023
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
162
MCQs
163. A) DISTINCTION
B) PASS
C) FAIL
D) Compiler error
Q15.What is the output of Java program below?[CO1]
float temp = 98.4f;
if(temp > 98.4)
{
System.out.println("SUMMER");
}
Else
{ System.out.println("UNKNOWN");
}
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 163
MCQs
164. A) SUMMER
B) UNKNOWN
C) Compiler error
D) None
Q16. What is the output of the Java program below?[CO1]
if(3>1) { 4; }
A) 0
B) 4
C) Compiler error
D) None
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 164
MCQs
165. 17-10-2023
1. Attempt all the parts. Pick the correct option from glossary. [CO1]
i) Abstraction ii) Encapsulation iii) Inheritance iv) Polymorphism
a) _________ means one entity have different behaviours in different situations.
b) _________ is used to bind the code and data.
c) _________ is used to hide the necessary details from outside world.
d) _________ is used to acquire properties of one class into other.
2. Attempt all the parts. Pick the correct option from glossary. [CO1]
i) Super class ii) Sub class iii) Reusability iv) Redundant code
a) Inheritance can eliminate _________.
b) A parent class is also known as _________ .
c) Using an existing code is known as ________.
d) A child class is also known as _________ .
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 165
Glossary Questions
171. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 171
Old University Question Paper
172. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 172
Old University Question Paper
173. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 173
Old University Question Paper
174. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 174
Old University Question Paper
175. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 175
Old University Question Paper
176. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 176
Old University Question Paper
177. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 177
Old University Question Paper
178. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 178
Old University Question Paper
179. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 179
Old University Question Paper
180. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 180
Old University Question Paper
181. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 181
Old University Question Paper
182. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 182
Old University Question Paper
183. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 183
Old University Question Paper
184. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 184
Old University Question Paper
185. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 185
Old University Question Paper
186. 17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 186
Old University Question Paper
187. 17-10-2023
Q1. Make Object diagram of Library management system. [CO1]
Q2.Make the class diagram for e-commerce System. [CO1]
Q3.Elaborate the concept of Inheritance and polymorphism with suitable example. [CO1]
Q4.Give differences between Break and Continue statement with an example. [CO1]
Q5.Give example code illustrating the use of if-else-if . [CO1]
Q6. State the different OOT strategies. [CO1]
Q7 Differentiate between class diagram and object diagram. [CO1]
Q8 Explain command line arguments. [CO1]
Q9 Explain the important points to be remembered while drawing object diagrams. [CO1]
Q10 Explain the working of if-else-if ladder. [CO1]
Q11Explain the importance of using break in switch statement. [CO1]
Q12Explain while loop with its syntax and an example. [CO1]
Q13Explain a real life example of polymorphism.
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 187
Expected Questions
188. Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Old Question Papers
•https://www.iare.ac.in/sites/default/files/IARE_JAVA_MODEL_QP.pdf
•https://www.manaresults.co.in/jntuh/download.php?subcode=133BM
17-10-2023 188
189. 17-10-2023
• The main aim of OOP is to bind together the data and the functions that operate on
them so that no other part of the code can access this data except that function.
• Object-oriented modeling and design is a way of thinking about problems using
models organized around real world concepts.
• Decision-making statements evaluate the Boolean expression and control the
program flow depending upon the result of the condition provided.
Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA 189
Recap of Unit
190. 190
17-10-2023 Ram Kumar Sharma ACSE0302 UNIT-1 OBJECT ORIENTED TECHNIQUES USING JAVA
Text Books:
(1) Herbert Schildt,” Java - The Complete Reference”, McGraw Hill Education 12th edition
(2) Herbert Schildt,” Java: A Beginner’s Guide”, McGraw-Hill Education 2nd edition
(3) James Rumbaugh et. al, “Object Oriented Modeling and Design”, PHI 2nd Edition
Reference Books:
(4) Cay S. Horstmann, “Core Java Volume I – Fundamentals”, Prentice Hall
(5) Joshua Bloch,” Effective Java”, Addison Wesley
(6) E Balagurusamy, “Programming with Java A Primer”, TMH, 4th edition.
References