Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 
avatar of Shayanlinux

Shayanlinux

Shayanlinux has asked 0 questions and find answers to 1 problems.

Stats

27
EtPoint
9
Vote count
0
questions
1
answers

About


public class Shayanlinux {
    private static class ShayanlinuxSingletonHolder{
        private static final Shayanlinux INSTANCE = new Shayanlinux();
    }
    private String about;
    // Because Shayanlinux is singleton the constructor is private
    private Shayanlinux() {
        about = "An Explorer!";
    }
    public static Shayanlinux getInstance(){
        return ShayanlinuxSingletonHolder.INSTANCE;
    }
    public String getAbout() {
        return this.about;
    }
}

public class Stackoverflow {
    public static void main(String args[])
        {
           System.out.println(Shayanlinux.getInstance().getAbout());
        }
}