




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A compilation of 11 lectures from introducing to advanced level of OOP through Java
Typology: Study notes
1 / 308
This page cannot be seen from the preview
Don't miss anything!
Object-Oriented Programming
Java
Goals
Java language
Short History
Java technology
JDK javac, jar, debugging
JRE java, libraries
JVM
Properties
Hello World Application
HelloWorld.java
HelloWorld.class
javac HelloWorld.java
bytecode
java HelloWorld
Runtime
JVM
Garbage Collection
● Dynamically allocated memory
● Deallocation
● Is done automatically (system-level thread)
● Checks for and frees memory no longer needed
Module 2
Object-Oriented Programming
Object-oriented programming
Classes and Objects
Declaring Classes
● Syntax
● Example
public class Counter{ private int value; public void inc(){ ++value; } public int getValue(){ return value; } }
Declaring Attributes
● Syntax
● Examples
public class Foo{ private int x; private float f = 0.0; private String name =”Anonymous”; }
Accessing Object Members
● Syntax
● Examples
public class Counter{ public static final int MAX = 100; private int value = 0;
public void inc(){ if( value < MAX ){ ++value; } } public int getValue(){ return value; } }
Counter c = new Counter(); c.inc(); int i = c.getValue();
Information Hiding
● The problem:
● Client code has direct access to internal data