The document discusses object-oriented programming fundamentals including packages, access specifiers, the this keyword, encapsulation, inheritance, overriding, and polymorphism. A package organizes related classes and interfaces into namespaces. Access specifiers set access levels for classes, variables, methods, and constructors. The this keyword refers to the current object. Encapsulation hides implementation details by making fields private and providing public access methods. Inheritance allows a class to acquire properties of another class. Overriding defines a method with the same signature as a parent method. Polymorphism allows an object to take on multiple forms through method overloading and object references to child classes.
Java abstract class & abstract methods,Abstract class in java
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
Abstraction is a process by which concepts are derived from the usage and classification of literal ("real" or "concrete") concepts.
Abstraction is a concept that acts as a super-categorical noun for all subordinate concepts, and connects any related concepts as a group, field, or category.
Java abstract class & abstract methods,Abstract class in java
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
Abstraction is a process by which concepts are derived from the usage and classification of literal ("real" or "concrete") concepts.
Abstraction is a concept that acts as a super-categorical noun for all subordinate concepts, and connects any related concepts as a group, field, or category.
Learn the various forms of polymorphism in Java with illustrative examples to explain method overloading(Compile-time polymorphism) and method overriding(Run-time polymorphism)
Object oriented programming with pythonArslan Arshad
A short intro to how Object Oriented Paradigm work in Python Programming language. This presentation created for beginner like bachelor student of Computer Science.
Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea behind inheritance in java is that you can create new classes that are built upon existing classes.
This ppt gives a general idea about the multithreading concepts in the java programming language. hope you find it useful
P.S :
sorry there is a correction in one of the slides
where i have entered implements thread
it is wrong it is actually implements Runnable
thank you!
Super keyword is a reference variable that is used for refer parent class object. Super keyword is used in java at three level, at variable level, at method level and at constructor level.
Collections Framework is a unified architecture for managing collections, Main Parts of Collections Framework
1. Interfaces :- Core interfaces defining common functionality exhibited by collections
2. Implementations :- Concrete classes of the core interfaces providing data structures
3. Operations :- Methods that perform various operations on collections
Learn the various forms of polymorphism in Java with illustrative examples to explain method overloading(Compile-time polymorphism) and method overriding(Run-time polymorphism)
Object oriented programming with pythonArslan Arshad
A short intro to how Object Oriented Paradigm work in Python Programming language. This presentation created for beginner like bachelor student of Computer Science.
Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea behind inheritance in java is that you can create new classes that are built upon existing classes.
This ppt gives a general idea about the multithreading concepts in the java programming language. hope you find it useful
P.S :
sorry there is a correction in one of the slides
where i have entered implements thread
it is wrong it is actually implements Runnable
thank you!
Super keyword is a reference variable that is used for refer parent class object. Super keyword is used in java at three level, at variable level, at method level and at constructor level.
Collections Framework is a unified architecture for managing collections, Main Parts of Collections Framework
1. Interfaces :- Core interfaces defining common functionality exhibited by collections
2. Implementations :- Concrete classes of the core interfaces providing data structures
3. Operations :- Methods that perform various operations on collections
Vision academe Pune is a leading institute in Pune conducting training programs for various software fields & provides certification for both individuals and organizations.Training Institute Pune is subsidiary of Optimized Infotech which offers IT services and training.
Learn how to use advanced web development concepts like OO and MVC in PHP. Project-focused demos and labs using your tool stack and environment More coding than lecture, coupled with architectural and design discussions.
Vision Academy is a well known Computer Training Institute in Hadapsar Pune from 2005.This institute was started by its visionary director Mr Sachin Zurange. Mr Sachin Zurange was completed MSc(Scientific Computing) From Interdisciplinary School Of Scientific Computing, University of Pune. It also clear SET exam in May 2018. We provides BCS, BCA, BBA(Comp.App), MCS, MCA, Dip(Comp), BE(Comp/IT) Coaching Classes in Hadapsar Pune. We mainly impart training in programming languages C,C++, Java, Advanced Java, Php, Phyton, .NET,HTML, Java Script, jQuery, Angular Js. Database Languages such as Oracle, Postgres, Mysql, SQL Server & focus on key subjects like Data Structure, Operating System,Rdbms. We provides career oriented programs in Web Design, WordPress, Digital Marketing courses. More then 10,000 students was trained from Vision Academy. We provide 100% practical oriented training program with 100% job placement.
Learn PHP fundamentals online at your own pace. Start today and improve your skills. Join millions of learners from around the world already learning on Udemy. Lifetime access. 204,000+ online courses. Millions of learners. 30-day guarantee. Real-world experts.
Similar to encapsulation, inheritance, overriding, overloading (20)
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
2. What Is a Package?
A package is a namespace that organizes a set of RELATED classes and interfaces. It is
similar to different folders on your computer.
Example - Image based classes in one package, maths based in another package, general
utility based classes in another, and so on...
PACKAGE
The Java platform provides an enormous class library (a set of packages) suitable for use in
your own applications. This library is known as the "Application Programming Interface",
or "API" for short.
import java.lang.*;
import java.util.*;
Example -
• a String object contains state and behavior for character strings;
• a File object allows a programmer to easily create, delete, inspect, compare, or
modify a file on the filesystem;
• a Socket object allows for the creation and use of network sockets;
3. What is Access Specifier?
A mechanism to set access levels for classes, variables, methods and constructors. The four
access levels are:
//In increasing order of accessibility
• PRIVATE - Visible to the same class only.
• DEFAULT - Visible to the same package. No modifiers are needed.
• PROTECTED - Visible to the package and all subclasses.
• PUBLIC - Visible to the world.
ACCESS SPECIFIERS in JAVA
public class Student {
private String course;
}
4. class Test{
public static void main(String[] args){
Student ramesh = new Student();
//To set the value of the course attribute.
//INCORRECT
ramesh.course="B.Tech";
//To get the value of the course attribute.
//This statement is INCORRECT
System.out.println("Course name of ramesh is: "
+ramesh.course);
}
}
ACCESS SPECIFIERS in JAVA
5. What is Access Specifier?
A mechanism to set access levels for classes, attributes, variables, methods and
constructors. The four access levels are:
//In increasing order of accessibility
• PRIVATE - Visible to the same class only.
• DEFAULT - Visible to the same package. No modifiers are needed.
• PROTECTED - Visible to the package and all subclasses.
• PUBLIC - Visible to the world.
ACCESS SPECIFIERS in JAVA
public class Student {
private String course;
public void setCourse(String courseNew) {
this.course = courseNew;
}
public String getCourse() {
return this.course;
}
}
6. class Test{
public static void main(String[] args){
Student ramesh = new Student();
//To set the value of the course attribute.
//INCORRECT
ramesh.course="B.Tech";
//CORRECT
ramesh.setCourse("B.Tech");
//To get the value of the course attribute.
//This statement is INCORRECT
System.out.println("Course name of ramesh is: “
+ramesh.course);
//CORRECT statement
System.out.println("Course name of ramesh is: “
+ramesh.getCourse());
}
}
ACCESS SPECIFIERS in JAVA
7. Within a method/constructor, this is a reference to the current object — the object whose
method/constructor is being called.
this KEYWORD in JAVA
public class Point {
public int x = 0;
public int y = 0;
//constructor
public Point(int a, int b){
x = a;
y = b;
}
}
public class Point {
public int x = 0;
public int y = 0;
//constructor
public Point(int x, int y){
this.x = x;
this.y = y;
}
}
8. From within a constructor, you can also use the this keyword to call another constructor in
the same class. Doing so is called an explicit constructor invocation.
this KEYWORD in JAVA – Example 2
public class Rectangle {
private int x, y;
private int width, height;
public Rectangle() {
this(0, 0, 1, 1);
}
public Rectangle(int width, int height) {
this(0, 0, width, height);
}
public Rectangle(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
...
}
9. Technical Definition:
Encapsulation is the technique of making the fields in a class private and
providing access to the fields via public methods.
ENCAPSULATION
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.
10. ENCAPSULATION - EXAMPLE
1. class Student{
2. private String name;
3. public String getName(){
4. return name;
5. }
6. public void setName(String newName){
7. name = newName;
8. }
9. }
10.class Execute{
11. public static void main(String args[]){
12. String localName;
13. Student s1 = new Student();
14. localName = s1.getName();
15. }
16.}
At line no14, we can not write localName = s1.name;
The public methods are the access points to a
class's private fields(attributes) from the
outside class.
11. Technical Definition:
Inheritance can be defined as the process where one object (or class) acquires
the properties of another (object or class).
With the use of inheritance the information is made manageable in a hierarchical
order.
INHERITANCE
ANIMAL
MAMMEL
DOG
REPTILE
12. INHERITANCE
In programming, inheritance is brought by using the keyword EXTENDS
In theory, it is identified using the keyword IS-A.
By using these keywords we can make one object acquire the properties of
another object.
This is how the extends keyword is used to achieve
inheritance.
public class Animal{
}
public class Mammal extends Animal{
}
public class Reptile extends Animal{
}
public class Dog extends Mammal{
}
13. INHERITANCE
Now, based on the above example, In Object Oriented terms, the following are
true:
• Animal is the superclass of Mammal class.
• Animal is the superclass of Reptile class.
• Mammal and Reptile are subclasses of Animal class.
• Dog is the subclass of both Mammal and Animal classes.
Alternatively, if we consider the IS-A relationship, we can say:
• Mammal IS-A Animal
• Reptile IS-A Animal
• Dog IS-A Mammal
Hence : Dog IS-A Animal as well
14. INHERITANCE – EXAMPLE – IS-A RELATIONSHIP
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 the following result:
true
true
true
15. INHERITANCE – EXAMPLE – HAS-A RELATIONSHIP
Determines whether a certain class HAS-A certain thing.
Lets us look into an example:
class Vehicle{}
class Speed{}
class Van extends Vehicle{
private Speed sp;
}
This shows that class Van HAS-A Speed.
By having a separate class for Speed, we do not have to put the entire code that belongs
to speed inside the Van class., which makes it possible to reuse the Speed class in multiple
applications.
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 following is illegal:
public class Dog extends Animal, Mammal{}; This is wrong
16. OVERRIDING
The process of defining a method in child class with the same name & signature as
that of a method already present in parent class.
If a class inherits a method from its super class, then there is a chance
to override the method provided that it is not marked final.
Benefit: A subclass can implement a parent class method based on its
requirement.
In object-oriented terms, overriding means to override the functionality
of an existing method.
17. OVERRIDING – EXAMPLE 1
class Animal{
public void move(){
System.out.println("Animals can move");
}
}
class Dog extends Animal{
public void move(){
System.out.println("Dogs can walk and run");
}
}
class TestDog{
public static void main(String args[]){
Animal a = new Animal();
// Animal reference and object
Animal b = new Dog();
// Animal reference but Dog object
a.move();// runs the method in Animal class
b.move();//Runs the method in Dog class
}
}
Animals can move
Dogs can walk and run
18. OVERRIDING – BASE REFERENCE AND CHILD OBJECT
Suppose there is a scenario that CHILD inherits BASE class, as shown in the figure.
BASE
CHILD
Both BASE and CHILD classes would have their own methods,
as well as some overridden methods, if any.
Category I: Methods present in BASE class only.
Category II: Methods present in CHLD class only.
Category III: Methods available in BASE but overridden in
CHILD.
Now, if we create an object with BASE class reference and
CHILD class object as:
BASE ref = new CHILD();
Then, ref could access the methods belonging to Category I
and Category III only.
19. OVERRIDING – EXAMPLE 1 - EXPLANANTION
In the above example, even though b is a type of Animal; it runs the move
method in the Dog class.
REASON:
In compile time, the check is made on the reference type.
However, in the runtime, JVM figures out the object type and would run the
method that belongs to that particular object.
Therefore, in the above example, the program will compile properly since Animal
class has the method move. Then, at the runtime, it runs the method specific for
that object.
20. OVERRIDING – EXAMPLE 2
1. class Animal{
2. }
3. class Dog extends Animal{
4. public void bark(){
5. System.out.println("Dogs can bark");
6. }
7. }
8. public class TestDog{
9. public static void main(String args[]){
10. Animal a = new Animal(); // Animal reference and
object
11. Animal b = new Dog(); // Animal reference but Dog
object
12. b.bark();
13. }
14. }
Result (ERROR):
TestDog.java:12: cannot find symbol
symbol : method bark()
location: class Animal b.bark();
21. RULES FOR METHOD OVERRIDING – PART 1
1. The argument list should be exactly the same as that of the
overridden method.
2. The return type should be the same or a subtype of the return
type declared in the original overridden method in the
superclass.
3. The access level cannot be more restrictive than the overridden
method's access level. For example: if the superclass method is
declared public then the overridding method in the sub class
cannot be either private or protected.
4. Instance methods can be overridden only if they are inherited by
the subclass.
5. A method declared final cannot be overridden.
6. A method declared static cannot be overridden but can be re-
declared.
22. RULES FOR METHOD OVERRIDING – PART 2
7. If a method cannot be inherited, then it cannot be overridden.
8. A subclass within the same package as the instance's superclass
can override any superclass method that is not declared private
or final.
9. A subclass in a different package can only override the non-
final methods declared public or protected.
10. An overriding method can throw any uncheck exceptions,
regardless of whether the overridden method throws exceptions or
not. However the overriding method should not throw checked
exceptions that are new or broader than the ones declared by the
overridden method. The overriding method can throw narrower or
fewer exceptions than the overridden method.
11. Constructors cannot be overridden.
23. OVERRIDING: USING THE SUPER KEYWORD
class Animal{
public void move(){
System.out.println("Animals can move");
}
}
class Dog extends Animal{
public void move(){
super.move(); // invokes the super class method
System.out.println("Dogs can walk and run");
}
}
class TestDog{
public static void main(String args[]){
Animal b = new Dog();
// Animal reference but Dog object
b.move();
//Runs the method in Dog class
}
}
When invoking a superclass version of an
overridden method the super keyword is used.
This would produce the following result:
Animals can move
Dogs can walk and run
24. POLYMORPHISM
CASE I: METHOD POLYMORPHISM
We can have multiple methods with the same name in the same / inherited
/ extended class.
There are three kinds of such polymorphism (methods):
1. Overloading: Two or more methods with different signatures, in
the same class.
2. Overriding: Replacing a method of BASE class with another
(having the same signature) in CHILD class.
3. Polymorphism by implementing Interfaces.
POLYMORPHISM = 1 METHOD/OBJECT HAVING MANY FORMS/ROLES
25. POLYMORPHISM – METHOD OVERLOADING
class Test {
public static void main(String args[]) {
myPrint(5);
myPrint(5.0);
}
static void myPrint(int i) {
System.out.println("int i = " + i);
}
static void myPrint(double d) {
System.out.println("double d = " + d);
}
}
OUTPUT:
int i = 5
double d = 5.0
Please note that the signature of overloaded method
is different.
26. POLYMORPHISM – CONSTRUCTOR OVERLOADING
This example displays the way of overloading a constructor and a method
depending on type and number of parameters.
class MyClass {
int height;
MyClass() {
System.out.println("bricks");
height = 0;
}
MyClass(int i) {
System.out.println("Building new House that is "
+ i + " feet tall");
height = i;
}
void info() {
System.out.println("House is " + height
+ " feet tall");
}
void info(String s) {
System.out.println(s + ": House is “ + height + " feet
tall");
}
}
27. POLYMORPHISM – CONSTRUCTOR OVERLOADING
1. public class MainClass {
2. public static void main(String[] args) {
3. //Calling of Overloaded constructor:
4. MyClass t = new MyClass(0);
5. t.info();
6. //Calling of Overloaded method
7. t.info("overloaded method");
8. //Calling of DEFAULT constructor
9. MyClass x = new MyClass();
10. }
11.}
Result:
Building new House that is 0 feet tall.
House is 0 feet tall.
Overloaded method: House is 0 feet tall.
bricks
28. POLYMORPHISM
CASE II: OBJECT POLYMORPHISM
Example: The most common use of polymorphism in OOP occurs when a
parent class reference is used to refer to a child class object.
Note: In the below statement
BASE ref = new CHILD();
NOTE: ref is the reference.
Any Java object that can pass more than one IS-A test is considered to be
polymorphic.
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.
29. OBJECT POLYMORPHISM - EXAMPLE
public class Animal{
int a1;
void am1(){...}
}
public class Deer extends Animal {
int d1;
void dm1(){....}
}
public class Execute{
public static void main(String args[]){
Deer d = new Deer();
Animal a = d;
}
}
Here, there are two references a & d.
And both references are pointing to same object.
Hence, 1 object can play many roles.