From 54154b092e171fc6d7a3ba5cc109b7e42330849d Mon Sep 17 00:00:00 2001 From: Yahli Date: Sun, 3 Aug 2025 19:09:00 +0300 Subject: [PATCH 1/4] Until exercise 3 --- .idea/modules.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/.idea/modules.xml b/.idea/modules.xml index ef8a6f4..3944705 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,6 +2,7 @@ + From 5711f7d8d7cb69a2b95a3717ebea980043fd867e Mon Sep 17 00:00:00 2001 From: Yahli Date: Sun, 3 Aug 2025 19:37:23 +0300 Subject: [PATCH 2/4] Until exercise 5 --- HeapAndStack/HeapAndStack.iml | 11 +++++++++++ HeapAndStack/src/DoubleTimedValue.java | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 HeapAndStack/HeapAndStack.iml create mode 100644 HeapAndStack/src/DoubleTimedValue.java diff --git a/HeapAndStack/HeapAndStack.iml b/HeapAndStack/HeapAndStack.iml new file mode 100644 index 0000000..9092d60 --- /dev/null +++ b/HeapAndStack/HeapAndStack.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/HeapAndStack/src/DoubleTimedValue.java b/HeapAndStack/src/DoubleTimedValue.java new file mode 100644 index 0000000..71647a1 --- /dev/null +++ b/HeapAndStack/src/DoubleTimedValue.java @@ -0,0 +1,17 @@ +public class DoubleTimedValue { + private double value; + private double time; + + public DoubleTimedValue(double value, double time) { + this.value = value; + this.time = time; + } + + public void setTime(double time) { + this.time = time; + } + + public void setValue(double value) { + this.value = value; + } +} From 6a8ba7945d847c72f6880edce8c7602e7f4914e7 Mon Sep 17 00:00:00 2001 From: Yahli Date: Sun, 3 Aug 2025 19:41:44 +0300 Subject: [PATCH 3/4] Until exercise 6 --- HeapAndStack/src/DoubleDataSender.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 HeapAndStack/src/DoubleDataSender.java diff --git a/HeapAndStack/src/DoubleDataSender.java b/HeapAndStack/src/DoubleDataSender.java new file mode 100644 index 0000000..bb57f51 --- /dev/null +++ b/HeapAndStack/src/DoubleDataSender.java @@ -0,0 +1,19 @@ +import java.util.*; +import java.time.LocalTime; +public class DoubleDataSender { + private final String name; + private DoubleTimedValue doubleTimedValue; + + public DoubleDataSender(String name) { + this.name = name; + } + public void update() { + doubleTimedValue = new DoubleTimedValue(Math.random(), LocalTime.now().getSecond()); + } + + + public DoubleTimedValue getDoubleTimedValue() { + return doubleTimedValue; + } + +} From 9774450e00c19a9313a72bfcb57e5a4a6e0d22ab Mon Sep 17 00:00:00 2001 From: Yahli Date: Sun, 3 Aug 2025 19:56:29 +0300 Subject: [PATCH 4/4] Questions --- HeapAndStack/src/Main.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 HeapAndStack/src/Main.java diff --git a/HeapAndStack/src/Main.java b/HeapAndStack/src/Main.java new file mode 100644 index 0000000..51a4341 --- /dev/null +++ b/HeapAndStack/src/Main.java @@ -0,0 +1,12 @@ +public class Main { +//Question 1: 2 + // 5 +//Question 2: 5 +//Question 3: Stack placement + //name: Raz, age: 9 + //name: raz, age: 9 +//Question 4: name: Dan, age: 16 + //name: Dan, age: 16 +//Question 5: Before the GC cleans there is still the old cell of person 2 in the heap +//Question 6: +} \ No newline at end of file