Skip to content

A collection of files made during the Programming 2 course @ Sapienza

Notifications You must be signed in to change notification settings

ElBi21/JavaInJars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Java in Jars

A collection of files made during the Programming 2 course @ Sapienza

This work is licensed under CC BY-NC-SA 4.0
The license builds on top of Sapienza's Didactic Material Policy. More info at the end of the page


Introduction

The Programming 2 course I took during my first year at Sapienza was about Object Oriented programming, and the language that was used to teach us this programming paradigm was Java. This is a mere collection of files that explain useful concepts behind the vast world of OOP and Java itself. Each lesson has its own package, for a whopping total of around 20 packages

Lessons' topics

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

Licensing

I do not own the original files: in fact, they are the lecture materials provided by professor P. Cenciarelli. My work consisted in readapting them into a more readable format, including extra and more verbose comments, explining what was happening in the code. The CC license exists on top of Sapienza's original Content Policy, but clearly the owner of the files (so professor Cenciarelli) dictates which policy is enforced on his material. Hence, the CC license acts only as a mere protection on my readaptation of his content. If needed, I can readapt the license, or even remove it. If you are the owner of these files, feel free to contact me if needed.

Releases

No releases published

Packages

No packages published

Languages