Skip to content

Sapienza-ACSAI/Programming-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Programming-2 (Java)

Programming 2 (Java)

Taught by Prof. Pietro Cenciarelli in the a.y. 22/23

Course syllabus

  • Introduction to Object-Oriented Programming The Java language

  • Algebra and abstract data types. Classes and objects. Encapsulation

  • Polymorphism (part one): extending classes and inheritance

  • Abstract classes and interfaces

  • Packages. Access modifiers and scoping rules

  • Nested classes. Anonymous classes. Lambda expressions

  • Polymorphism (part two): Generics. Generic type hierarchy

  • Threads and process synchronization. Deadlock and starvation

  • Design patterns: creational, structural, behavioral, concurrency (Optional)

Keep in mind: The notes are not by each lecture, instead, they focus on concepts.

Feel free to contact me (Nil) on any platform if there's something wrong, missing, or if you have any suggestions so that I can fix it for future students.

Please be aware that the oral examination for this course is highly dynamic, and the questions can vary significantly from year to year. While the sample questions provided here can offer some guidance, it's essential to be prepared for a wide range of topics and formats, which also includes presenting your project (if you have one).

## Lessons' structure

Lesson Topics Files
01
  • How to print Hello World;
  • Creation of methods: how to make and call them;
  • Creation of attributes
HelloWorld.java
Sum.java
02
  • Various operations in Java (+, -, * and /);
  • Creation of objects;
  • Meaning of the static keyword
Counter.java
Lesson02_Main.java
Static.java
03
  • Concept of encapsulation and use of the private keyword;
  • Use of arrays to implement stacks;
  • Handling of exceptions;
    • Use of the throws keyword;
    • Use of the try {...} catch (Exception) {...} block;
    • Creation of new exceptions
ArrayStack.java
ArrayStack2.java
EmptyStackException.java
Encapsulation.java
FullStackException.java
Lesson03_Main.java
04
  • Implementation of linked lists;
  • Introduction of the null value;
  • The this object
EmptyStackException.java
IntList.java
Lesson04_Main.java
ListStack.java
05
  • Introduction to subclasses;
  • Use of this and super to respectively call the subclass' or the super class' constructor;
  • Concepts of inheritance, overloading and overriding;
  • Concept of polymorphism: methods are treated dynamically, while attributes are treated statically
FirstClass.java
Lesson05_Main.java
SecondClass.java
06
  • Packages, interfaces, abstract classes and methods, access modifiers (each topic is explained in a different package)
Lesson06_Main
  • Introduction to packages (1/2);
  • Extendability of packages through other packages
Package01
  • SuperPowers.java
  • TestPackage01Class.java
  • Introduction to packages (2/2);
  • Access modifiers (public, package-private (or default), protected and private)
Package02
  • Powers.java
  • TestPackage02Class.java
  • Application of inheritance in packages;
  • Dynamicity of this and staticity of super
Package03
  • ClassOne.java
  • ClassTwo.java
  • ClassThree.java
  • TestPackage03Class.java
  • Introduction to interfaces and abstract classses;
  • Concrete methods against abstract methods;
  • Concepts of variable
Package04
  • IntegerVar.java
  • IntegerVar_01.java
  • IntegerVar_02.java
  • ReadableInteger.java
  • WritableInteger.java
  • TestPackage04Class.java
07
  • Further examples of abstract classes and introduction of abstract methods;
  • Static fields
Benchmark.java
Children.java
ConcreteBenchmark.java
Lesson07_Main.java
08
  • Interfaces: fields, static and default interface methods;
  • Inheritance of default methods for multiple interfaces;
  • Inner classes, inner and outer objects;
  • Scopes;
  • Local classes
Clash.java
Interface1.java
Interface2.java
Lesson08_Main.java
ReverseStack.java
Stack.java
State.java
TestLocalClasses.java
09
  • Generics: implementation of GenericList;
  • Identities: differences between == and equals()
GenericIdentity.java
GenericList.java
IntList.java
Lesson09_Main.java
10
  • Generics: raw types, covariance and contravariance;
  • Wildcard: use of ? for indicating any type
ClassOne.java
ClassTwo.java
ClassThree.java
Generics.java
GenericsOne.java
GenericsTwo.java
Lesson10_Main.java
WildcardTest.java
11
  • Anonymous classes: implementation by extending classes and by implementing interfaces;
  • Functional interfaces;
  • Lambda expressions for replacing anonymous classes;
  • Closures
Closures.java
Functio.java
FunctioTest.java
LambdaTest.java
Lesson11_Main.java
MyReadable.java
Readable.java
TestAnonymous.java
12
  • Introduction to Threads and Runnables;
  • Implementation of delay() and run() methods;
  • Use of lambda expressions for creating a run() method
CompulsiveWordPrinter.java
Lesson12_Main.java
SleepyWordPrinter.java
ThreadTest.java
WordPrinter.java
13
  • Threads: concept of locks and monitors;
  • Implementation of synchronized methods or blocks;
  • Concept of deadlock
ArrayStack.java
AThreadMess.java
DeadLock.java
DeadManWarning.java
Lesson13_Main.java
NamedThread.java
NamePrinter.java
Popper.java
TestPrinter.java
14
  • Preference of synchronized inside the method's declaration rather than inside the method itself;
  • Implementation of ArrayStacks with threads;
  • Methods wait(), notify() and notifyAll()
BadStackImplementation.java
GoodStackImplementation.java
Lesson14_Main.java
Popper.java
Pusher.java
Stack.java
TestStack.java
YesWeCan.java

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages