1. CSE110
Principles of Programming
with Java
Lecture 14:
Object-Oriented Programming
Javier Gonzalez-Sanchez
javiergs@asu.edu
javiergs.engineering.asu.edu
Office Hours: By appointment
4. Javier Gonzalez-Sanchez | CSE110 | Summer 2017 | 4
Object-Oriented Paradigm
everything is an entity (object)
A program is a collection of objects working together
main()
5. Javier Gonzalez-Sanchez | CSE110 | Summer 2017 | 5
Everything is an object
CSE470
Computer
Graphics
CSE412
Databases
objects
objects
6. Javier Gonzalez-Sanchez | CSE110 | Summer 2017 | 6
class
Where we are?
main()
class
create a new entity/object
use the entity/object
7. Javier Gonzalez-Sanchez | CSE110 | Summer 2017 | 7
Object-Oriented Paradigm
public class MyProgram {
public static void main(String [] arg)
{
Student john = new Student();
john.name = "John Doe";
john.sayHello();
john.drawSomething();
}
}
public class Student {
String name;
int finalGrade;
public void sayHello(){
// print name
}
public void drawSomething(){
// draw
}
}
11. CSE110 - Principles of Programming
Javier Gonzalez-Sanchez
javiergs@asu.edu
Summer 2017
Disclaimer. These slides can only be used as study material for the class CSE110 at ASU. They cannot be distributed or used for another purpose.