This document discusses object-oriented programming principles like encapsulation, inheritance, polymorphism, abstract classes, and interfaces. It provides examples of how each principle is implemented in Java code. Encapsulation involves making fields private and providing public getter and setter methods. Inheritance allows new classes to inherit attributes and behaviors from existing classes in a hierarchy. Polymorphism allows a parent class reference to refer to child class objects. Abstract classes cannot be instantiated while interfaces contain only abstract methods and are implemented by classes.
The document discusses key concepts of object-oriented programming (OOP) including objects, classes, constructors, encapsulation, inheritance, and polymorphism. It provides examples to illustrate each concept. Objects contain data (states) and behaviors (methods). A class acts as a blueprint to create objects. Constructors initialize objects. Encapsulation hides implementation details and controls access via getters and setters. Inheritance allows classes to acquire properties and behaviors of other classes. Polymorphism allows the same method to process objects differently based on their data type.
The document provides an overview of C++ vs C# by Shubhra Chauhan. It discusses the key object-oriented programming concepts like classes, objects, inheritance, polymorphism, and how they are implemented in C++ and C#. It includes code examples to demonstrate class usage and inheritance in both languages. The document also compares some similarities and differences between C++ and C# like support for pointers, preprocessors, structures, and goto statements.
This chapter discusses decision making, object-oriented fundamentals, inner classes, and exception handling in Java. It describes the use of if and switch statements for decision making. It also covers access specifiers, encapsulation, inheritance, polymorphism, abstract classes, interfaces, inner classes, and exceptions.
The document discusses inheritance in Java programming. It defines inheritance as a mechanism that allows one class to inherit features like fields and methods from another class. There are three main types of inheritance discussed - single inheritance where one class inherits from another, multilevel inheritance where a class inherits from another inherited class, and hierarchical inheritance where multiple classes inherit from a single base class. The key concepts of superclass, subclass, method overriding and abstract classes are explained.
This document discusses inheritance in Java. It defines key terms like subclass, superclass, and reusability. It explains that a subclass inherits the properties and behaviors of its parent superclass. The syntax for inheritance in Java uses the "extends" keyword. The document provides two code examples to demonstrate inheritance - a Programmer subclass that inherits from an Employee superclass, and a My_Calculation subclass that inherits and extends the Calculation superclass with a new method.
This document summarizes key concepts in object-oriented programming (OOP) in Java, including static keyword, instance member, class member, inheritance, encapsulation, polymorphism, object, class, constructor, and more. It provides examples to illustrate static variables and methods, the this keyword, super keyword, final keyword, abstract classes vs interfaces, and method overloading as a form of compile-time polymorphism.
Basic concept of class, method , command line-argumentSuresh Mohta
A class is a blueprint that defines common behaviors and properties of objects. It contains fields to store data and methods to perform actions. Classes can contain modifiers, name, superclass, interfaces, and body. A class is used to create multiple objects with similar attributes and behaviors. Methods are functions defined within a class that operate on object data and perform actions. Command line arguments allow passing of input values to a program when it is run from the command line.
The document discusses key concepts of object-oriented programming (OOP) including objects, classes, constructors, encapsulation, inheritance, and polymorphism. It provides examples to illustrate each concept. Objects contain data (states) and behaviors (methods). A class acts as a blueprint to create objects. Constructors initialize objects. Encapsulation hides implementation details and controls access via getters and setters. Inheritance allows classes to acquire properties and behaviors of other classes. Polymorphism allows the same method to process objects differently based on their data type.
The document provides an overview of C++ vs C# by Shubhra Chauhan. It discusses the key object-oriented programming concepts like classes, objects, inheritance, polymorphism, and how they are implemented in C++ and C#. It includes code examples to demonstrate class usage and inheritance in both languages. The document also compares some similarities and differences between C++ and C# like support for pointers, preprocessors, structures, and goto statements.
This chapter discusses decision making, object-oriented fundamentals, inner classes, and exception handling in Java. It describes the use of if and switch statements for decision making. It also covers access specifiers, encapsulation, inheritance, polymorphism, abstract classes, interfaces, inner classes, and exceptions.
The document discusses inheritance in Java programming. It defines inheritance as a mechanism that allows one class to inherit features like fields and methods from another class. There are three main types of inheritance discussed - single inheritance where one class inherits from another, multilevel inheritance where a class inherits from another inherited class, and hierarchical inheritance where multiple classes inherit from a single base class. The key concepts of superclass, subclass, method overriding and abstract classes are explained.
This document discusses inheritance in Java. It defines key terms like subclass, superclass, and reusability. It explains that a subclass inherits the properties and behaviors of its parent superclass. The syntax for inheritance in Java uses the "extends" keyword. The document provides two code examples to demonstrate inheritance - a Programmer subclass that inherits from an Employee superclass, and a My_Calculation subclass that inherits and extends the Calculation superclass with a new method.
This document summarizes key concepts in object-oriented programming (OOP) in Java, including static keyword, instance member, class member, inheritance, encapsulation, polymorphism, object, class, constructor, and more. It provides examples to illustrate static variables and methods, the this keyword, super keyword, final keyword, abstract classes vs interfaces, and method overloading as a form of compile-time polymorphism.
Basic concept of class, method , command line-argumentSuresh Mohta
A class is a blueprint that defines common behaviors and properties of objects. It contains fields to store data and methods to perform actions. Classes can contain modifiers, name, superclass, interfaces, and body. A class is used to create multiple objects with similar attributes and behaviors. Methods are functions defined within a class that operate on object data and perform actions. Command line arguments allow passing of input values to a program when it is run from the command line.
Ohhh ok ok ok ok then i can be taken in my life and i am not able to enter the correct me if you are not able to see you in your eyes and sorry for the
This class is abstract but it does not provide implementation of abstract method print(). An abstract class must be subclassed and the abstract methods must be implemented in the subclass. We cannot create an object of an abstract class directly, it has to be through its concrete subclass.
The document provides an overview of lecture 03 on objects and classes in Java, including reviewing basic concepts, declaring and using classes, implementing inheritance, and discussing abstract classes and interfaces. It also includes examples of declaring classes, using constructors and methods, and implementing inheritance and polymorphism. The lecture aims to help students understand object-oriented concepts in Java like classes, objects, inheritance and polymorphism.
This document discusses object-oriented programming concepts including objects, classes, inheritance, polymorphism, abstraction, and encapsulation. It provides examples of how each concept is implemented in Java, including code snippets demonstrating classes, inheritance between classes, method overloading and overriding, and abstract classes. The key advantages of OOP such as code reusability and modularity are also summarized.
The document discusses inheritance in Java. It defines inheritance as a mechanism where a new class is derived from an existing class, allowing the subclass to inherit properties and methods from the superclass. The key advantages of inheritance include code reuse, flexibility, and abstraction. The document also covers different types of inheritance like single, multilevel, hierarchical and multiple inheritance. It explains concepts like overriding, super keyword, abstract classes and final keyword in the context of inheritance.
The error is that the Fruit superclass does not have a no-arg constructor, but the Apple subclass constructor does not explicitly call a superclass constructor. When a subclass does not explicitly call a superclass constructor, the compiler automatically inserts a no-arg super() call. But since Fruit does not have a no-arg constructor, this causes a compile-time error.
To fix it, the Apple constructor needs to explicitly call the Fruit constructor:
public Apple(String name) {
super(name);
System.out.println("Apple constructor is invoked");
}
The document provides an overview of basic Java concepts including:
1. Classes define data (fields) and code (methods) to represent objects, with fields accessible via getters/setters and methods operating on the fields.
2. Inheritance allows subclasses to extend existing classes, reusing and overriding their methods and fields.
3. Abstract classes define common interfaces for subclasses through abstract methods without bodies, while concrete subclasses implement the methods.
The document discusses inheritance in Java. It defines inheritance as a process where one class acquires properties, methods, and fields of another class. The class that inherits is called a subclass, and the class being inherited from is called a superclass. The extends keyword is used to inherit from a superclass. A subclass inherits all non-private members of its parent class and can define its own methods. The super keyword is used to refer to the superclass members when a subclass defines methods with same names. The document provides code examples to demonstrate inheritance and use of extends and super keywords.
The document discusses structures and classes in C++. It defines a structure called student with data members like name and roll number. It then defines a class called person with data members name and number and demonstrates creating an object of the class and accessing its members. The document also discusses concepts like defining member functions inside and outside classes, access specifiers, nesting member functions, and making outside member functions inline.
Inheritance and Polymorphism in java simple and clear ASHNA nadhm
This document discusses object-oriented programming concepts in Java like classes, objects, inheritance, polymorphism and encapsulation. It begins with defining what a class and object are - a class is a template that defines an object's data fields and methods, while an object is an instance of a class. The document then covers key OOP features like inheritance, where a subclass inherits properties from a superclass; polymorphism, which allows methods to behave differently based on the object; and encapsulation. Specific concepts like method overloading and overriding are explained in detail with examples.
Inheritance in Java beginner to advance with examples.pptxnaeemcse
Dive into the world of Java Inheritance and discover how it forms the backbone of robust and scalable code architecture. Learn how this powerful object-oriented programming concept allows you to effortlessly reuse and extend existing code, promoting a modular and maintainable design. Whether you're a novice or a seasoned developer, grasp the key principles of inheritance and elevate your Java programming skills. Join us on this journey to empower your code with the inheritance advantage, setting the stage for efficient development and enhanced software flexibility. Don't miss out on this essential building block for creating elegant and efficient Java applications!Unlock the potential of Java Inheritance with a concise exploration of single, multiple, multilevel, and hierarchical types. Discover how each type enhances code structure and flexibility. Elevate your Java skills by understanding the nuances of inheritance, optimizing code for efficiency and maintainability. Join us on this journey of code mastery and harness the diverse power of inheritance in your Java projects.
oops concept in java | object oriented programming in javaCPD INDIA
The document discusses key concepts in object-oriented programming in Java including classes, objects, inheritance, packages, interfaces, encapsulation, abstraction, and polymorphism. It provides examples to illustrate each concept. Classes define the structure and behavior of objects. Objects are instances of classes. Inheritance allows classes to extend existing classes. Packages organize related classes. Interfaces define behaviors without implementation. Encapsulation hides implementation details. Abstraction models essential features without specifics. Polymorphism allows the same method name with different signatures or overriding.
The document discusses C++ functions and classes. It provides examples of void and returning value functions, including a program to convert Fahrenheit to Celsius using a returning value function. It also discusses basics of classes, including defining a class with data members and member functions, and creating an object of that class to access its members.
Classes extend the built-in capabilities of C++ able you in representing and solving complex, real-world problems. A class is an organization of data and functions which operate on them. Data structures are called data members and the functions are called member functions, the combination of data members and member functions constitute a data
object or simply an object.
Class is a group of data member and member functions. Another word class is a collection of objects of similar type.
To create a class, use the class keyword followed by a name for the object. Like any other declared variable, the class declaration ends with a semi-colon. The name of a class follows the rules we have applied for variable and function names.
1. The document introduces classes, explaining concepts like data hiding, abstraction, and encapsulation. It defines a class as a way to bind data and associated functions together to represent real-world entities.
2. A class has four attributes - data members to describe characteristics, member functions for behaviors, an access level to control access, and a class name used to create objects. An example class Account is given with attributes like account number, type, balance and functions like deposit and withdraw.
3. Objects are instances of a class that allow manipulating the data and calling the functions of the class. Some examples of class objects are given.
- A class is the most important feature of C++ that supports object-oriented programming (OOP). It allows a program to be designed using classes which are a collection of data and functions.
- When an object of a class is declared, memory is allocated for that object's data members. However, defining a class alone does not allocate memory - it only specifies the data members and member functions.
- Member functions can access and manipulate the class's data members. They are called through an object using the dot operator. Constructors are special member functions that initialize an object's data members when it is created.
The document discusses key concepts in object-oriented software engineering including objects, classes, encapsulation, inheritance, polymorphism, and abstraction. It provides examples and definitions for each concept to illustrate how they are applied in object-oriented programming.
This document provides an overview of object-oriented programming (OOP) concepts in PHP including classes, objects, encapsulation, polymorphism, inheritance, magic methods, interfaces, abstract classes, and type hinting. Key points covered include defining classes with properties and methods, instantiating objects from classes, visibility of properties and methods, extending and overriding parent classes, implementing interfaces, and using polymorphism through interfaces to allow different classes to be used interchangeably.
The document discusses object-oriented programming concepts including inheritance, abstraction, encapsulation, and polymorphism. It covers fundamental OOP principles, defining inheritance between classes, using abstract classes and interfaces, encapsulating data within classes, and allowing polymorphism through inheritance. Specific examples are provided to demonstrate each concept.
Ohhh ok ok ok ok then i can be taken in my life and i am not able to enter the correct me if you are not able to see you in your eyes and sorry for the
This class is abstract but it does not provide implementation of abstract method print(). An abstract class must be subclassed and the abstract methods must be implemented in the subclass. We cannot create an object of an abstract class directly, it has to be through its concrete subclass.
The document provides an overview of lecture 03 on objects and classes in Java, including reviewing basic concepts, declaring and using classes, implementing inheritance, and discussing abstract classes and interfaces. It also includes examples of declaring classes, using constructors and methods, and implementing inheritance and polymorphism. The lecture aims to help students understand object-oriented concepts in Java like classes, objects, inheritance and polymorphism.
This document discusses object-oriented programming concepts including objects, classes, inheritance, polymorphism, abstraction, and encapsulation. It provides examples of how each concept is implemented in Java, including code snippets demonstrating classes, inheritance between classes, method overloading and overriding, and abstract classes. The key advantages of OOP such as code reusability and modularity are also summarized.
The document discusses inheritance in Java. It defines inheritance as a mechanism where a new class is derived from an existing class, allowing the subclass to inherit properties and methods from the superclass. The key advantages of inheritance include code reuse, flexibility, and abstraction. The document also covers different types of inheritance like single, multilevel, hierarchical and multiple inheritance. It explains concepts like overriding, super keyword, abstract classes and final keyword in the context of inheritance.
The error is that the Fruit superclass does not have a no-arg constructor, but the Apple subclass constructor does not explicitly call a superclass constructor. When a subclass does not explicitly call a superclass constructor, the compiler automatically inserts a no-arg super() call. But since Fruit does not have a no-arg constructor, this causes a compile-time error.
To fix it, the Apple constructor needs to explicitly call the Fruit constructor:
public Apple(String name) {
super(name);
System.out.println("Apple constructor is invoked");
}
The document provides an overview of basic Java concepts including:
1. Classes define data (fields) and code (methods) to represent objects, with fields accessible via getters/setters and methods operating on the fields.
2. Inheritance allows subclasses to extend existing classes, reusing and overriding their methods and fields.
3. Abstract classes define common interfaces for subclasses through abstract methods without bodies, while concrete subclasses implement the methods.
The document discusses inheritance in Java. It defines inheritance as a process where one class acquires properties, methods, and fields of another class. The class that inherits is called a subclass, and the class being inherited from is called a superclass. The extends keyword is used to inherit from a superclass. A subclass inherits all non-private members of its parent class and can define its own methods. The super keyword is used to refer to the superclass members when a subclass defines methods with same names. The document provides code examples to demonstrate inheritance and use of extends and super keywords.
The document discusses structures and classes in C++. It defines a structure called student with data members like name and roll number. It then defines a class called person with data members name and number and demonstrates creating an object of the class and accessing its members. The document also discusses concepts like defining member functions inside and outside classes, access specifiers, nesting member functions, and making outside member functions inline.
Inheritance and Polymorphism in java simple and clear ASHNA nadhm
This document discusses object-oriented programming concepts in Java like classes, objects, inheritance, polymorphism and encapsulation. It begins with defining what a class and object are - a class is a template that defines an object's data fields and methods, while an object is an instance of a class. The document then covers key OOP features like inheritance, where a subclass inherits properties from a superclass; polymorphism, which allows methods to behave differently based on the object; and encapsulation. Specific concepts like method overloading and overriding are explained in detail with examples.
Inheritance in Java beginner to advance with examples.pptxnaeemcse
Dive into the world of Java Inheritance and discover how it forms the backbone of robust and scalable code architecture. Learn how this powerful object-oriented programming concept allows you to effortlessly reuse and extend existing code, promoting a modular and maintainable design. Whether you're a novice or a seasoned developer, grasp the key principles of inheritance and elevate your Java programming skills. Join us on this journey to empower your code with the inheritance advantage, setting the stage for efficient development and enhanced software flexibility. Don't miss out on this essential building block for creating elegant and efficient Java applications!Unlock the potential of Java Inheritance with a concise exploration of single, multiple, multilevel, and hierarchical types. Discover how each type enhances code structure and flexibility. Elevate your Java skills by understanding the nuances of inheritance, optimizing code for efficiency and maintainability. Join us on this journey of code mastery and harness the diverse power of inheritance in your Java projects.
oops concept in java | object oriented programming in javaCPD INDIA
The document discusses key concepts in object-oriented programming in Java including classes, objects, inheritance, packages, interfaces, encapsulation, abstraction, and polymorphism. It provides examples to illustrate each concept. Classes define the structure and behavior of objects. Objects are instances of classes. Inheritance allows classes to extend existing classes. Packages organize related classes. Interfaces define behaviors without implementation. Encapsulation hides implementation details. Abstraction models essential features without specifics. Polymorphism allows the same method name with different signatures or overriding.
The document discusses C++ functions and classes. It provides examples of void and returning value functions, including a program to convert Fahrenheit to Celsius using a returning value function. It also discusses basics of classes, including defining a class with data members and member functions, and creating an object of that class to access its members.
Classes extend the built-in capabilities of C++ able you in representing and solving complex, real-world problems. A class is an organization of data and functions which operate on them. Data structures are called data members and the functions are called member functions, the combination of data members and member functions constitute a data
object or simply an object.
Class is a group of data member and member functions. Another word class is a collection of objects of similar type.
To create a class, use the class keyword followed by a name for the object. Like any other declared variable, the class declaration ends with a semi-colon. The name of a class follows the rules we have applied for variable and function names.
1. The document introduces classes, explaining concepts like data hiding, abstraction, and encapsulation. It defines a class as a way to bind data and associated functions together to represent real-world entities.
2. A class has four attributes - data members to describe characteristics, member functions for behaviors, an access level to control access, and a class name used to create objects. An example class Account is given with attributes like account number, type, balance and functions like deposit and withdraw.
3. Objects are instances of a class that allow manipulating the data and calling the functions of the class. Some examples of class objects are given.
- A class is the most important feature of C++ that supports object-oriented programming (OOP). It allows a program to be designed using classes which are a collection of data and functions.
- When an object of a class is declared, memory is allocated for that object's data members. However, defining a class alone does not allocate memory - it only specifies the data members and member functions.
- Member functions can access and manipulate the class's data members. They are called through an object using the dot operator. Constructors are special member functions that initialize an object's data members when it is created.
The document discusses key concepts in object-oriented software engineering including objects, classes, encapsulation, inheritance, polymorphism, and abstraction. It provides examples and definitions for each concept to illustrate how they are applied in object-oriented programming.
This document provides an overview of object-oriented programming (OOP) concepts in PHP including classes, objects, encapsulation, polymorphism, inheritance, magic methods, interfaces, abstract classes, and type hinting. Key points covered include defining classes with properties and methods, instantiating objects from classes, visibility of properties and methods, extending and overriding parent classes, implementing interfaces, and using polymorphism through interfaces to allow different classes to be used interchangeably.
The document discusses object-oriented programming concepts including inheritance, abstraction, encapsulation, and polymorphism. It covers fundamental OOP principles, defining inheritance between classes, using abstract classes and interfaces, encapsulating data within classes, and allowing polymorphism through inheritance. Specific examples are provided to demonstrate each concept.
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxEduSkills OECD
Iván Bornacelly, Policy Analyst at the OECD Centre for Skills, OECD, presents at the webinar 'Tackling job market gaps with a skills-first approach' on 12 June 2024
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
Communicating effectively and consistently with students can help them feel at ease during their learning experience and provide the instructor with a communication trail to track the course's progress. This workshop will take you through constructing an engaging course container to facilitate effective communication.
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
2. OOP Principles
Encapsulation and Data abstraction.
Inheritance
Super keyword
Abstract Classes
Interface
Polymorphism
Method overridding
Method overloading
Packages
Passing and returning objects
Wrapper Classes (Reading
Assignment)
3. All object-oriented programming languages
provide mechanisms that help you implement the
object-oriented model.
The three fundamental object oriented
programming principles are:
Encapsulation (data hiding) and Data
abstraction
Inheritance
Polymorphism
Main purpose of these principles is to manage
software system complexity by improving software
quality factors.
4. Encapsulation refers to
the combining of fields and
methods together in a class
such that the methods
operate on the data, as
opposed to users of the
class accessing the fields
directly.
It is a the technique
which involves making
the fields in a class private
and providing access to
the fields via public
..
Class
5. If a field is declared private, it cannot be accessed
by anyone outside the class, thereby hiding the
fields within the class.
For this reason, encapsulation is also referred to as
data hiding.
Encapsulation can be described as a protective
barrier that prevents the code and data being
randomly accessed by other code defined outside
the class.
Access to the data and code is tightly controlled by
an interface.
The main benefit of encapsulation is the ability to
modify our implemented code without breaking the
6. public class EncapTest{
private String name;
private String idNum;
private int age;
public int getAge(){
return age;
}
public String
getName(){
return name;
}
public String getIdNum(){
return idNum;
}
public void setAge( int
newAge){
age = newAge;
}
public void
setName(String newName){
name = newName;
}
public void setIdNum(
String newId){
idNum = newId;
}
}
7. The public methods are the access points to this class’s
fields from the outside java world.
Normally these methods are referred as getters and
setters. Therefore any class that wants to access the
variables should access them through these getters and
setters.
The variables of the EncapTest class can be accessed
as below:
public class RunEncap{
public static void main(String args[]){
EncapTest encap = new EncapTest();
encap.setName("James");
encap.setAge(20);
encap.setIdNum("12343ms");
System.out.print("Name : " + encap.getName()+ " Age : "+
encap.getAge());
}
}
Out Put:
Name : James Age : 20
8. Classes normally hide
the details of their
implementation from
their clients.
This is called information
hiding.
The client cares about
what functionality a
class offers, not about
how that functionality is
implemented.
This concept is referred
to as data abstraction.
12. In object-oriented programming (OOP)
Inheritance is the capability of a class to use the
properties and methods of another class (Super
Classes) while adding its own functionality.
I.e. Inheritance is a way to form new classes using
classes that have already been defined.
Inheritance is employed to help reuse existing code
with little or no modification.
The new classes, known as derived classes, inherit
attributes and behavior of the pre-existing classes,
which are referred to as base classes (or ancestor
classes).
The inheritance relationship of sub- and
superclasses gives rise to a hierarchy.
With the use of inheritance the information is made
manageable in a hierarchical order.
13. Elements to be inherited form parent class are
protected and public Members.
Applications of inheritance
Specialization
the new class or object has data or behavior
aspects that are not part of the inherited class.
Overriding
permit a class or object to replace the
implementation of an aspect—typically a
behavior—that it has inherited
Code re-use
re-use of code which already existed in another
class.
14. When we talk about inheritance in java the most
commonly used key words would be extends and
implements.
These words would determine whether one object
IS-A type of another.
With use of the extends keyword the subclasses
will be able to inherit all the properties of the
superclass except for the private properties of the
superclass.
IS-A defines relationship between a superclass and
its subclasses.
This means that an object of a subclass can be
15. public class Student {
protected String name;
public Student() {
name = “”;
}
public Student(String s) {
name = s;
}
public String getName() {
return name;
}
} Note: Object is the super class of all Java Classes
16. Now based on the above example, In Object Oriented
terms following are true:
Animal is the superclass of Mammal and Reptile classes.
Mammal and Reptile are subclasses of Animal class.
Dog is the subclass of both Mammal and Animal classes.
A very important fact to remember is that Java only
supports only single inheritance. This means that a
class cannot extend more than one class. Therefore
the following is illegal:
public class extends Animal, Mammal{…}
public class Animal{ …}
public class Mammal extends Animal{…}
public class Reptile extends Animal{…}
public class Dog extends Mammal{…}
17. We can assure that Mammal is actually an Animal with
the use of the instance operator.
public class Dog extends Mammal{
public static void main(String args[]){
Animal a = new Animal();
Mammal m = new Mammal();
Dog d = new Dog();
System.out.println(m instanceof Animal);
System.out.println(d instanceof Mammal);
System.out.println(d instanceof Animal);
}
} This would produce following result:
true
true
true
18.
19.
20.
21.
22. When extending a class constructor you can reuse the
immediate superclass constructor and overridden
superclass methods by using the reserved word
super.
Note that
You cannot override final methods, methods in final
classes, private methods or static methods.
Example
class A{
int a, b, c;
A(int p, int q, int r){
a=p;
b=q;
c=r;
}
void Show(){
System.out.println("a = " + a);
System.out.println("b = " + b);
System.out.println("c = " + c);
}
}
23. public class B extends A{
int d;
B(int l, int m, int n, int o){
super(l, m, n);
d=o;
}
void Show(){
super.show()
System.out.println("d = " + d);
}
public static void main(String args[]
){
B b = new B(4,3,8,7);
b.Show();
}
}
Output
a =
4
b =
3
c =
8
d =
7
24. An abstract class is one that cannot be instantiated.
Abstraction refers to the ability to make a class abstract
in OOP.
All other functionality of the class still exists, and its
fields, methods, and constructors are all accessed in
the same manner.
Classes that can be instantiated are known as concrete
classes.
If a class is abstract and cannot be instantiated, the
class does not have much use unless it is subclassed.
This is typically how abstract classes come about during
the design phase.
A parent class contains the common functionality of a
collection of child classes, but the parent class itself is
too abstract to be used on its own.
25. public abstract class Employee{
private String name, address;
private int number;
public Employee(String name, String address, int
number){
System.out.println("Constructing an Employee");
this.name = name;
this.address = address;
this.number = number;
}
public double computePay() {
System.out.println("Inside Employee computePay");
return 0.0;
}
26. public void mailCheck(){
System.out.println("Within mailCheck of Salary class ");
System.out.println("Mailing a check to " + name + " " +
address); }
public String toString() {
return name + " " + address + " " + number; }
public String getName() { return name; }
public String getAddress() { return address; }
public void setAddress(String newAddress) { address =
newAddress; }
public int getNumber(){ return number; }
}
When you would compile, using instances of Employee
class, above class then you would get following error:
27. public class Salary extends Employee {
private double salary; //Annual salary
public Salary(String name, String address, int number,
double salary){
super(name, address, number);
setSalary(salary);
}
public void mailCheck(){
System.out.println("Within mailCheck of Salary
class ");
System.out.println("Mailing check to " + getName()
+ " with salary " + salary);
}
28. public double getSalary(){ return salary; }
public void setSalary(double newSalary){
if(newSalary >= 0.0){
salary = newSalary;
}
}
public double computePay(){
System.out.println("Computing salary pay for " +
getName());
return salary/52;
}
}
29. Here we cannot instantiate a new Employee, but if we
instantiate a new Salary object, the Salary object will
inherit the three fields and seven methods from Employee.
public class AbstractDemo{
public static void main(String [] args) {
Salary s = new Salary("Mohd ", "Ambehta, UP“, 3,
3600.00);
Salary e = new Salary("John ", "Boston, MA", 2,
2400.00);
System.out.println("Call mailCheck using Salary
reference --");
s.mailCheck();
System.out.println("n Call mailCheck using Employee
reference--");
e.mailCheck();
30. This would produce following result:
Constructing an Employee
Constructing an Employee
Call mailCheck using Salary reference --
Within mailCheck of Salary class
Mailing check to Mohd Mohtashim with salary 3600.0
Call mailCheck using Employee reference--
Within mailCheck of Salary class
Mailing check to John Adams with salary 2400.
31. If you want a class to contain a particular method but
you want the actual implementation of that method to be
determined by child classes, you can declare the
method in the parent class as abstract.
The abstract keyword is also used to declare a method
as abstract.
An abstract methods consist of a method signature, but
no method body - its signature is followed by a
semicolon, not curly braces as usual.
Declaring a method as abstract has two results:
The class must also be declared abstract. If a class
contains an abstract method, the class must be abstract as
well.
32. public abstract class Employee{
private String name, address;
private int number;
public abstract double computePay();
…//remainder of the class definition
}
public class Salary extends Employee{
private double salary; //Annual salary
public double computePay(){
System.out.println("Computing salary pay for " +
getName());
return salary/52;
}
…//remainder of the class defiition
}
33. Interfaces are similar to abstract classes but all
methods are abstract and all data fields are static final.
That is an interface is a collection of abstract methods and
static final variables.
Interfaces can be inherited (i.e. you can have a sub-
interface). As with classes the extends keyword is used
for inheritance.
A class implements an interface, thereby inheriting the
abstract methods of the interface.
An interface is not a class. Writing an interface is similar
to writing a class, but they are two different concepts. A
class describes the attributes and behaviors of an
object. An interface contains behaviors that a class
34. Unless the class that implements the interface is
abstract, all the methods of the interface need to
be defined in the class.
Java does not allow multiple inheritance for
classes (i.e. a subclass being the extension of
more than one superclass).
An interface is similar to a class in the following
ways:
An interface can contain any number of methods.
An interface is written in a file with a .java
extension, with the name of the interface matching
the name of the file.
The bytecode of an interface appears in a .class
file.
35. However, an interface is different from a class in
several ways, including:
You cannot instantiate an interface.
An interface does not contain any constructors.
All of the methods in an interface are abstract.
An interface cannot contain instance fields.
An interface is not extended by a class; it is
implemented by a class.
An interface can extend multiple interfaces.
36. The interface keyword is used to declare an
interface.
public interface NameOfInterface
{
//Any number of final, static fields
//Any number of abstract method declarations
}
Interfaces have the following properties:
An interface is implicitly abstract. You do not need to use
the abstract keyword when declaring an interface.
Each method in an interface is also implicitly abstract, so
the abstract keyword is not needed.
Methods in an interface are implicitly public.
37. A class uses the implements keyword to implement an
interface.
The implements keyword appears in the class declaration
following the extends portion of the declaration.
interface Animal { public void eat(); public void travel(); }
public class MammalInt implements Animal{
public void eat(){ System.out.println("Mammal eats"); }
public void travel(){ System.out.println("Mammal travels"); }
public int noOfLegs(){ return 0; }
public static void main(String args[]){
MammalInt m = new MammalInt();
m.eat();
m.travel();
}
}
Output:
Mammal eats
Mammal travels
38. An interface can extend another interface, similarly to
the way that a class can extend another class.
The extends keyword is used to extend an interface,
and the child interface inherits the methods of the
parent interface.
public interface Sports{
public void setHomeTeam(String name);
public void setVisitingTeam(String name);
}
public interface Football extends Sports{
public void homeTeamScored(int points);
public void visitingTeamScored(int points);
public void endOfQuarter(int quarter);
}
39. public interface Hockey extends Sports{
public void homeGoalScored();
public void visitingGoalScored();
public void endOfPeriod(int period);
public void overtimePeriod(int ot);
}
The Hockey interface has four methods, but it inherits
two from Sports; thus, a class that implements Hockey
needs to implement all six methods.
Similarly, a class that implements Football needs to
define the three methods from Football and the two
methods from Sports.
Note that an interface can extend more than one parent
interface
40. When should you use an abstract class, when an
interface, when both?
Interfaces and abstract classes seem superficially to
provide almost the same capability.
How do you decide which to use?
interfacevsabstract.html
41. Polymorphism (from the Greek, meaning “many forms”)
is the ability of an object to take on many forms.
The most common use of polymorphism in OOP occurs
when a parent class reference is used to refer to a child
class object.
A reference variable can be of only one type. Once
declared the type of a reference variable cannot be
changed.
The reference variable can be reassigned to other
objects provided that it is not declared final.
The type of the reference variable would determine the
methods that it can invoke on the object.
A reference variable can refer to any object of its
42. public class Shape{
public double computeArea(){ return -1; }
Public double computeCircumfrence(){ return -1; }
}
public class Circle extends Shape{
private double radius;
public Circle(double r){ this.radius = r;}
public double computeArea(){return Math.PI*this.radius *
this.radius; }
public double computeCircumfrence(){ return
2*Math.PI*this.radius; }
}
43. public class Rectangle extends Shape{
private double width;
private double height;
public Rectangle(double w, double h){this.width =
0;this.height = 0;}
public double computeArea(){ return this.width *
this.height; }
public double computeCircum(){return 2*(this.width
*this.height);}
}
public class ShapeTest{
public static void main(String args[]){
Shape[] shapes = new Shape[3];
shapes[0] = new Circle(4.0);
44. double totalArea = 0;
for(int i = 0;i<shapes.length;i++){
totalArea+=shapes[i].computeArea();
}
System.out.println(“Total area = “ +totalArea);
}
}
Out Put: Total area = 60.44424265506762
A reference variable of type Shape is used to refer
objects of types of its subclasses (Circle and
rectangle)
What is the output of the above code if you comment
out computeArea() method in Circle and Rectangle
classes?
Out Put: Total area = -3.0
45. When a superclass variable contains a reference to a
subclass object, and that reference is used to call a
method, the subclass version of the method is called.
(See the example on shapes)
The output illustrates that the appropriate methods for
each class are indeed invoked based on the type of
the object to which shapes refers.
This is called dynamic binding or late binding.
However, if a program needs to perform a subclass-
specific operation on a subclass object referenced by
a superclass variable, the program must first cast the
superclass reference to a subclass reference through
a technique known as downcasting.
This enables the program to invoke subclass methods
that are not in the superclass.
46. To know which subclass’s object (or any of subclass’s
subclass objects) is stored in a supperclass reference,
use instanceOf operator.
And if it is the type of the subclass in question,
downcast it explicitly.
For Example if a Rectangle class had getDiagonal()
method and if we want to use this method we must first
downcast it.
if(shap[1] instanceOf Rectangle)
Rectangle r = (Rectangle)shapes[1];
We cannot treat a superclass object as a subclass
object because a superclass object is not an object of
any of its subclasses.
47. It is possible to display each shape’s type as a
string.
for(int i = 0;i<shapes.length;i++){
System.out.printf( “Shape %d is a %sn", i,
shapes[ i] .getClass().getName());
}
The output is
Shape 0 is a Circle
Shape 1 is a Rectangle
Shape 2 is a Circle
48. Polymorphism can also be achieved through
method overriding and method overloading.
Overridden methods
are methods that are redefined within an inherited
or subclass. They have the same signature and the
subclass definition is used.
The implementation in the subclass overrides
(replaces) the implementation in the superclass.
In other words an instance method in a subclass
with the same signature (name, plus the number and
the type of its parameters) and return type as an
instance method in the superclass overrides the
superclass's method.
49. class Rectangle {
private int x, y, w, h;
public String toString() {
return “x = “ + x + “, y = “ + y +“, w = “ + w + “, h = “ + h;
}
}
class DecoratedRectangle extends Rectangle {
private int borderWidth;
public String toString() {
return super.toString() + “, borderWidth = “ +
borderWidth;
}
}
50. The argument list should be exactly the same as that
of the overridden method.
The return type should be the same or a subtype of
the return type declared in the original overridden
method in the super class.
The access level cannot be more restrictive than the
overridden method's access level. For example: if the
super class method is declared public then the
overridding method in the sub class cannot be either
private or protected. However the access level can
be less restrictive than the overridden method's
access level.
Instance methods can be overridden only if they are
inherited by the subclass.
Constructors cannot be overridden.
51. A method declared final cannot be overridden.
A method declared static cannot be overridden but can be
re-declared.
If a method cannot be inherited then it cannot be
overridden.
A subclass within the same package as the instance's
superclass can override any superclass method that is
not declared private or final.
A subclass in a different package can only override the
non-final methods declared public or protected.
An overriding method can throw any uncheck exceptions,
regardless of whether the overridden method throws
exceptions or not. However the overridden method should
not throw checked exceptions that are new or broader
52. We already have discussed method overriding,
where a child class can override a method in its
parent.
An overridden method is essentially hidden in the
parent class, and is not invoked unless the child
class uses the super keyword within the overriding
method.
Calling overridden method from subclass using super
class reference is referred to as virtual method
invocation, and the methods are referred to as virtual
methods.
All methods in Java behave in this manner, whereby
an overridden method is invoked at run time, no
53. Method Overloading
Overloaded methods are methods with the same name
signature but either a different number of parameters or
different types in the parameter list.
Compiler automatically select the most appropriate method
based on the parameter supplied.
Example
public class MultiplyNumbers {
public int Multiply(int a, int b) {
return a * b;
}
public int Multiply(int a, int b, int c) {
eturn a*b*c;
}
}
54. A Package (named collections of classes) can be
defined as a grouping of related types(classes and
interfaces) providing access protection and name space
management.
Packages are used in Java in-order to prevent naming
conflicts, to control access, to make searching/locating
and usage of classes, interfaces, enumerations and
annotations easier etc.
Java has numerous built in packages: java.io, java.lang,
java.util …
Programmers can define their own packages to bundle
group of classes/interfaces etc.
It is a good practice to group related classes
55. When creating a package, you should choose a name
for the package and put a package statement with that
name at the top of every source file that contains the
classes and interfaces types that you want to include in
the package.
The package statement should be the first line in the
source file.
There can be only one package statement in each
source file, and it applies to all types in the file.
It is common practice to use lowercased names of
packages to avoid any conflicts with the names of
classes, interfaces.
If a package statement is not used then the class and
56. If a class wants to use another class in the same
package, the package name does not need to be
used.
Classes in the same package find each other
without any special syntax.
A class file can contain any number of import
statements.
The import statements must appear after the
package statement and before the class
declaration.
Let us look at an example that creates a package
called animals.
57. package animals;
interface Animal {
public void eat();
public void travel();
}
//-------------------------------------------------------------------------
-
package animals;
public class MammalInt implements Animal{
public void eat(){ System.out.println("Mammal eats");
}
public void travel(){ System.out.println("Mammal
58. public static void main(String args[]){
MammalInt m = new MammalInt();
m.eat();
m.travel();
}
}
Now you compile these two files and put them in a
sub-directory called animals and try to run as follows:
$ mkdir animals
$ cp Animal.class MammalInt.class animals
$ java animals/MammalInt
Mammal eats
Mammal travels
59. Here a class named Boss is added to the payroll
package that already contains Employee.
The Boss can then refer to the Employee class without
using the payroll prefix, as demonstrated by the
following Boss class.
package payroll;
public class Boss{
public void payEmployee(Employee e) {
e.mailCheck();
}
}
60. If Boss was not in the payroll package, then use
one of the following techniques for referring to a
class in a different package.
The fully qualified name of the class can be used.
For example: payroll.Employee
The package can be imported using the import
keyword and the wild card (*).
For example: import payroll.*;
The class itself can be imported using the import
keyword.
For example: import payroll.Employee;
61. Passing by value for primitive type value
the value is passed to the parameter
Passing by value for reference type value
the value is the reference to the object
Example
public class TestPassObject {
public static void main(String[] args) {
radius 1 Circle3 myCircle = new Circle3(1);
int n = 5;
printAreas(myCircle, n);
System.out.println("n" + "Radius is " +
myCircle.getRadius());
System.out.println("n is " + n);
}
62. public static void printAreas(Circle3 c, int times) {
System.out.println("Radius ttArea");
while (times >= 1) {
System.out.println(c.getRadius() + "tt" +
c.getArea()); c.setRadius(c.getRadius() + 1);
times--;
}
}
}
A reference type of Circle3 called c is passed to
a function printAreas()
63. public class BirthDate {
private int year;
private int month;
private int day;
public BirthDate(int newYear,
int newMonth, int newDay) {
year = newYear;
month = newMonth;
day = newDay;
}
public void setYear(int newYear) {
year = newYear;
}
}
64. public class Student {
private int id;
private BirthDate birthDate;
public Student(int ssn,
int year, int month, int day) {
id = ssn;
birthDate = new BirthDate(year, month, day);
}
public int getId() {
return id;
}
public BirthDate getBirthDate() {
return birthDate;
}
}
BirthDate is
returned
65. public class Test {
public static void main(String[]args{
Student student = new
Student(111223333, 1970, 5, 3);
BirthDate date =
student.getBirthDate();
date.setYear(2010);
// Now the student birth year is changed!
}
}