What is object-oriented programming?
Itâs a collection of ideas.
- Encapsulate code and data
- Abstract data types
- They hide how they work on the inside
- âAbstractâ = correct behavior, but the inside workings are hidden
- Overloading
- Changes how an operator works
- For example,
+
on integers vs. strings
- Inheritance
- âI want an object just like another, but slightly differentâ (without copy and pasting)
- DRY
People came up with objects because theyâre a good model for many things in real life.
Java
- One file per class (unlike C++, which has a header file and body file)
- Itâs an interpreted language
- Java â Machine code for Java Virtual Machine â Execute code on the Java Virtual Machine
- Compilation
javac Foo.java
compiles Foo.class
etc files
java Foo
runs Foo.class
âs public static void main
method