//His disciples said to him, "Behold, now you speak plainly, and speak no figures of speech. (John 16:29) ---------------------------------------------Solution.java---------------------------------------------------- package com.javarush.task.task17.task1706; /* Ð¡Ð¸Ð½Ñ ÑонизиÑованнÑй пÑÐµÐ·Ð¸Ð´ÐµÐ½Ñ */ public class Solution { public static void main(String[] args) { OurPresident expectedPresident = OurPresident.getOurPresident(); OurPresident ourPresident = OurPresident.getOurPresident(); System.out.println(expectedPresident == ourPresident ); } } -------------------------------------------------------------------------------------------------------------- --------------------------------------------OurPresident.java------------------------------------------------- package com.javarush.task.task17.task1706; public class OurPresident { private static OurPresident president; static{ synchronized(OurPresident.class) { president = new OurPresident(); } } private OurPresident() { } public static OurPresident getOurPresident() { return president; } } -------------------------------------------------------------------------------------------------------------- /* Ð¡Ð¸Ð½Ñ ÑонизиÑованнÑй пÑÐµÐ·Ð¸Ð´ÐµÐ½Ñ Ð Ñнова Singleton паÑÑеÑн â ÑÐ¸Ð½Ñ ÑонизаÑÐ¸Ñ Ð² ÑÑаÑиÑеÑком блоке ÐнÑÑÑи клаÑÑа OurPresident в ÑÑаÑиÑеÑком блоке ÑоздайÑе ÑÐ¸Ð½Ñ ÑонизиÑованнÑй блок. ÐнÑÑÑи ÑÐ¸Ð½Ñ ÑонизиÑованного блока иниÑиализиÑÑйÑе president. ТÑебованиÑ: 1.âÐлаÑÑ OurPresident должен ÑодеÑжаÑÑ Ð¿ÑиваÑнÑÑ ÑÑаÑиÑеÑкое поле OurPresident president. 2.âÐлаÑÑ OurPresident должен ÑодеÑжаÑÑ Ð¿ÑблиÑнÑй ÑÑаÑиÑеÑкий меÑод OurPresident getOurPresident(). 3.âÐлаÑÑ OurPresident должен ÑодеÑжаÑÑ Ð¿ÑиваÑнÑй конÑÑÑÑкÑоÑ. 4.âÐлаÑÑ OurPresident должен ÑодеÑжаÑÑ ÑÑаÑиÑеÑкий блок. 5.âÐнÑÑÑи ÑÑаÑиÑеÑкого блока клаÑÑа OurPresident должен бÑÑÑ ÑÐ¸Ð½Ñ ÑонизиÑованнÑй блок. 6.âÐнÑÑÑи ÑÐ¸Ð½Ñ ÑонизиÑованного блока должно бÑÑÑ Ð¿ÑоиниÑиализиÑовано поле president. package com.javarush.task.task17.task1706; * Ð¡Ð¸Ð½Ñ ÑонизиÑованнÑй пÑÐµÐ·Ð¸Ð´ÐµÐ½Ñ * public class Solution { public static void main(String[] args) { OurPresident expectedPresident = OurPresident.getOurPresident(); OurPresident ourPresident = OurPresident.getOurPresident(); System.out.println(expectedPresident == ourPresident ); } } */