You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
zanninso a89a441036 docs: adding more details 4 months ago
..
ExerciseRunner.java docs: adding more details 4 months ago
README.md docs: adding more details 4 months ago

README.md

Singleton Blueprint

Instructions

You are given an incomplete Singleton class. Complete the class to demonstrate your understanding of how the Singleton design pattern works. The Singleton pattern ensures that a class has only one instance and provides a global point of access to that instance.

Expected Class

public class Singleton {
    public Singleton instance;

    private Singleton() {
    }

    public Singleton get???() {
    }

    public String whoAreYou() {
        return "Hello, I am a singleton!"
    }
}

Usage

Here is a possible ExerciseRunner.java to test your class:

public class ExerciseRunner {
    public static void main(String[] args) {
        System.out.println(Singleton.get???().whoAreYou());
    }
}

Expected Output

$ javac *.java -d build
$ java -cp build ExerciseRunner
Hello, I am a singleton!
$