Skip to content

Instantly share code, notes, and snippets.

View thinkphp's full-sized avatar
💭
If I have seen further it is only by standing on the shoulders of giants. Newton

Adrian Statescu thinkphp

💭
If I have seen further it is only by standing on the shoulders of giants. Newton
View GitHub Profile
@thinkphp
thinkphp / ja_pruefung_2016ws-aufgabe5.java
Created June 10, 2025 06:23
ja_pruefung_2016ws-aufgabe5.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
class ButtonToggleApp extends JFrame implements ActionListener {
private JButton button;
private Timer colorTimer;
private boolean isRunning = false;
private boolean isRed = false;
@thinkphp
thinkphp / ja_pruefung_2016ws-aufgabe4.java
Created June 10, 2025 06:22
ja_pruefung_2016ws-aufgabe4.java
class MyException extends Exception {
public MyException(String msg) {
super(msg);
}
}
class Throw {
public static int part(int x) throws MyException {
if (x == 0)
throw new MyException("Division by zero");
@thinkphp
thinkphp / ja_pruefung_2016ws-aufgabe3.java
Last active June 10, 2025 06:20
ja_pruefung_2016ws-aufgabe3.java
// ============================================================================
// AUFGABE 3 - Clase abstracte si mostenire
// ============================================================================
// a) Abstract base class
abstract class Routenelement {
public abstract int getLaenge();
}
// Concrete implementations
@thinkphp
thinkphp / ja_pruefung_2016ws-aufgabe2.java
Created June 10, 2025 06:16
ja_pruefung_2016ws-aufgabe2.java
/*
RĂSPUNSURI pentru Exercițiul 2 - Analiza vizibilității:
1: return mb2; în clasa A
- PERMIS: mb2 este protected în B, iar A extinde B, deci A poate accesa membrii protected ai lui B
2: return mb1 + b.mb1; în clasa B
- PERMIS: mb1 este private în B, dar îl accesăm din cadrul aceleiași clase B
3: return b1 + c.mc; în clasa B
@thinkphp
thinkphp / a_pruefung_2016ws-aufgabe1.java
Last active June 10, 2025 06:42
ja_pruefung_2016ws
// ============================================================================
// AUFGABE 1 - Polymorphism and Method Overriding
// ============================================================================
// Class diagram shows:
class A {
public void meth() {
System.out.println("Method from class A");
}
@thinkphp
thinkphp / aufgabeGUI.java
Last active June 5, 2025 10:24
Aufgabe 4 (GUI: ca. 25 %)
//javac --module-path ~/javafx-sdk/lib --add-modules javafx.controls GuiAufgabe.java
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
@thinkphp
thinkphp / Aufgabe3.java
Created June 5, 2025 09:35
Aufgabe3 Range Iterator
import java.util.Iterator;
class Range implements Iterable<Integer>, Iterator<Integer> {
private int current;
private int end;
private int step;
public Range(int init, int end, int step) {
@thinkphp
thinkphp / aufgabe2ab.java
Created June 5, 2025 09:19
Aufgabe 2 a si b
import java.util.*;
//clasa adresa
class Adresse {
private String ort;
private String plz;
private String strasse;
private String hausNr;
@thinkphp
thinkphp / aufgabe1b.java
Last active June 5, 2025 08:19
Aufgabe1-b
//Aufgabe 1) b)
public class ExceptionHandlingTest {
static public void setzeFarbe(String farbe) throws Exception {
if (!farbe.equals("rot") && !farbe.equals("blau"))
throw new Exception("Ungueltige Farbe " + farbe);
System.out.println("Setze Farbe " + farbe + "!");
}
@thinkphp
thinkphp / Aufgabe1-2019.java
Created June 5, 2025 07:28
Aufgabe1 Streams Lambdas vs Tradictional
import java.util.*;
import java.util.stream.*;
//clasa Student
class Student {
private String name;
private int alter;
private int matrikelNr;