{"id":4508,"date":"2026-09-24T09:00:00","date_gmt":"2026-09-24T09:00:00","guid":{"rendered":"https:\/\/otus.ru\/journal\/?p=4508"},"modified":"2026-09-25T15:28:45","modified_gmt":"2026-09-25T15:28:45","slug":"inkapsulyaciya-v-java-prosto-o-slozhnom","status":"publish","type":"post","link":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/","title":{"rendered":"\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java: private-\u043f\u043e\u043b\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b, \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435"},"content":{"rendered":"<p><strong>\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java<\/strong> &#8212; \u044d\u0442\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u041e\u041e\u041f, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u043b\u0430\u0441\u0441 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u043e\u043b\u044f\u0445 (<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code>) \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u0430 \u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430. \u0426\u0435\u043b\u044c &#8212; \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0432 \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u043d\u0430\u0440\u0443\u0436\u0438: \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u0430\u043d\u0441, \u043f\u0443\u0441\u0442\u043e\u0435 \u0438\u043c\u044f, \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430.<\/p>\n<div class=\"oj-toc\" style=\"background:#f6f6f6;border-radius:8px;padding:14px 20px;margin:20px 0\">\n<p><strong>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/strong><\/p>\n<ol>\n<li><a href=\"#s1\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e: \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u043e\u043b\u044f<\/a><\/li>\n<li><a href=\"#s2\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0441\u043b\u0435: private-\u043f\u043e\u043b\u044f \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u043c\u0438<\/a><\/li>\n<li><a href=\"#s3\">\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a private-\u043f\u043e\u043b\u044e<\/a><\/li>\n<li><a href=\"#s4\">\u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432 Java<\/a><\/li>\n<li><a href=\"#s5\">\u0413\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b: \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b, \u0430 \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0442<\/a><\/li>\n<li><a href=\"#s6\">\u0423\u0442\u0435\u0447\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u0433\u0435\u0442\u0442\u0435\u0440: \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438<\/a><\/li>\n<li><a href=\"#s7\">\u041d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 record<\/a><\/li>\n<li><a href=\"#s8\">\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f &#8212; \u043d\u0435 \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0432\u0437\u043b\u043e\u043c\u0430<\/a><\/li>\n<li><a href=\"#s9\">\u0412\u044b\u0432\u043e\u0434\u044b<\/a><\/li>\n<li><a href=\"#s10\">\u0413\u0434\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \/ \u0441\u0432\u044f\u0437\u044c \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439<\/a><\/li>\n<li><a href=\"#s11\">FAQ<\/a><\/li>\n<\/ol>\n<\/div>\n<p>\u0422\u0440\u0438 \u0441\u043b\u043e\u0432\u0430 \u0447\u0430\u0441\u0442\u043e \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u044e\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0440\u0430\u0437\u0443 \u0440\u0430\u0437\u0432\u0435\u0434\u0443 \u0438\u0445:<\/p>\n<table>\n<thead>\n<tr>\n<th>\u0422\u0435\u0440\u043c\u0438\u043d<\/th>\n<th>\u0427\u0442\u043e \u044d\u0442\u043e<\/th>\n<th>\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 Java<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f<\/td>\n<td>\u041f\u0440\u0438\u043d\u0446\u0438\u043f: \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c\u0438 \u0436\u0438\u0432\u0443\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435, \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0431\u043e\u0439\u0442\u0438<\/td>\n<td>\u041f\u043e\u043b\u044f + \u043c\u0435\u0442\u043e\u0434\u044b \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u043c\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430<\/td>\n<\/tr>\n<tr>\n<td>\u0421\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/td>\n<td>\u0421\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u0438: \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0432\u0438\u0434\u043d\u044b \u0441\u043d\u0430\u0440\u0443\u0436\u0438<\/td>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code>-\u043f\u043e\u043b\u044f<\/td>\n<\/tr>\n<tr>\n<td>\u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/td>\n<td>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u044f\u0437\u044b\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0434\u0435\u043b\u0430\u044e\u0442<\/td>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code>, \u0431\u0435\u0437 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430, <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">protected<\/code>, <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">public<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u0421\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0431\u0435\u0437 \u043f\u0440\u0430\u0432\u0438\u043b &#8212; \u0435\u0449\u0435 \u043d\u0435 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f: <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code>-\u043f\u043e\u043b\u0435 \u0441 \u0441\u0435\u0442\u0442\u0435\u0440\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e, \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">public<\/code>-\u043f\u043e\u043b\u0435. \u041d\u0438\u0436\u0435 &#8212; \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441 \u00ab\u0434\u043e\u00bb \u0438 \u00ab\u043f\u043e\u0441\u043b\u0435\u00bb, \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b, \u0434\u0432\u0435 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u0443\u0442\u0435\u0447\u043a\u0438 \u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b.<\/p>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b \u043d\u0430 OpenJDK 25.0.4 (Temurin, Java 25 LTS) 24 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f 2026 \u0433\u043e\u0434\u0430, \u0432\u044b\u0432\u043e\u0434 \u0438 \u0442\u0435\u043a\u0441\u0442\u044b \u043e\u0448\u0438\u0431\u043e\u043a \u0432\u0437\u044f\u0442\u044b \u0438\u0437 \u043f\u0440\u043e\u0433\u043e\u043d\u0430.<\/p>\n<h2 id=\"s1\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e: \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u043e\u043b\u044f<\/h2>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u044f: \u0431\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u0438\u0439 \u0441\u0447\u0435\u0442. \u041a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0439\u0442\u0438 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0446\u0438\u0444\u0440\u0443 \u0432 \u0432\u0435\u0434\u043e\u043c\u043e\u0441\u0442\u0438, \u043e\u043d \u043f\u0440\u043e\u0441\u0438\u0442 \u043a\u0430\u0441\u0441\u0438\u0440\u0430, \u0430 \u0442\u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043b\u0438 \u0434\u0435\u043d\u0435\u0433. \u0411\u0435\u0437 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0431\u0435\u0437 \u043a\u0430\u0441\u0441\u0438\u0440\u0430.<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">class<\/span> <span style=\"color: #E5C07B\">Account<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">owner<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E5C07B\">long<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\">; <\/span><span style=\"color: #7F848E\">\/\/ \u043a\u043e\u043f\u0435\u0439\u043a\u0438<\/span>\n\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">Account<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">owner<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E5C07B\">long<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">this<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">owner<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">owner<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">this<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">class<\/span> <span style=\"color: #E5C07B\">Main<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">static<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">void<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">main<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #56B6C2\">[]<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">args<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">Account<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">Account<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0410\u043d\u043d\u0430\"<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #D19A66\">10_000<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">-<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">25_000<\/span><span style=\"color: #ABB2BF\">; <\/span><span style=\"color: #7F848E\">\/\/ \u0441\u043f\u0438\u0441\u0430\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0435\u0441\u0442\u044c<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">owner<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">null<\/span><span style=\"color: #ABB2BF\">;                    <\/span><span style=\"color: #7F848E\">\/\/ \u0438 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0438<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">System<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">out<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">println<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">owner<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #98C379\">\": \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n<span style=\"color: #ABB2BF\">}<\/span><\/code><\/pre>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">null: -15000\n<\/code><\/pre>\n<p>\u041e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435\u0442, \u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043b\u043e\u043c\u0430\u043d: \u0431\u0430\u043b\u0430\u043d\u0441 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u043d\u0435\u0442. \u041b\u044e\u0431\u043e\u0439 \u043a\u043e\u0434, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">acc<\/code>, \u043c\u043e\u0436\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a \u0436\u0435, \u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u0432\u0438\u043d\u043e\u0432\u0430\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443.<\/p>\n<h2 id=\"s2\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0441\u043b\u0435: private-\u043f\u043e\u043b\u044f \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u043c\u0438<\/h2>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">import<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">java.util.Objects<\/span><span style=\"color: #ABB2BF\">;<\/span>\n\n<span style=\"color: #C678DD\">class<\/span> <span style=\"color: #E5C07B\">Account<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">private<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">final<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">owner<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">private<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">long<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\">; <\/span><span style=\"color: #7F848E\">\/\/ \u0432 \u043a\u043e\u043f\u0435\u0439\u043a\u0430\u0445, \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 0<\/span>\n\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">Account<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">owner<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E5C07B\">long<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">initial<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">this<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">owner<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">Objects<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">requireNonNull<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">owner<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #98C379\">\"owner\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">initial<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">&lt;<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #C678DD\">throw<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">IllegalArgumentException<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"initial &lt; 0: \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">initial<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        }<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">this<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">initial<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">getOwner<\/span><span style=\"color: #ABB2BF\">() {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">return<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">owner<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">long<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">getBalance<\/span><span style=\"color: #ABB2BF\">() {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">return<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">void<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">deposit<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E5C07B\">long<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">amount<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">amount<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">&lt;=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #C678DD\">throw<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">IllegalArgumentException<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"amount &lt;= 0: \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">amount<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        }<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">Math<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">addExact<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E06C75\">amount<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">void<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">withdraw<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E5C07B\">long<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">amount<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">amount<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">&lt;=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">0<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #C678DD\">throw<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">IllegalArgumentException<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"amount &lt;= 0: \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">amount<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        }<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">amount<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">&gt;<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #C678DD\">throw<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">IllegalStateException<\/span><span style=\"color: #ABB2BF\">(<\/span>\n<span style=\"color: #ABB2BF\">                <\/span><span style=\"color: #98C379\">\"\u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432: \u0431\u0430\u043b\u0430\u043d\u0441 \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #98C379\">\", \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043e \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">amount<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        }<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">balance<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">-=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">amount<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">class<\/span> <span style=\"color: #E5C07B\">Main<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">static<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">void<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">main<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #56B6C2\">[]<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">args<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">Account<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">Account<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0410\u043d\u043d\u0430\"<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #D19A66\">10_000<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">deposit<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">5_000<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">withdraw<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">3_000<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">System<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">out<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">println<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getOwner<\/span><span style=\"color: #ABB2BF\">() <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #98C379\">\": \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getBalance<\/span><span style=\"color: #ABB2BF\">());<\/span>\n\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">try<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">withdraw<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #D19A66\">25_000<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        } <\/span><span style=\"color: #C678DD\">catch<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">IllegalStateException<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">e<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #E06C75\">System<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">out<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">println<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u041e\u0442\u043a\u0430\u0437: \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">e<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getMessage<\/span><span style=\"color: #ABB2BF\">());<\/span>\n<span style=\"color: #ABB2BF\">        }<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">try<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">deposit<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #56B6C2\">-<\/span><span style=\"color: #D19A66\">100<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        } <\/span><span style=\"color: #C678DD\">catch<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">IllegalArgumentException<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">e<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #E06C75\">System<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">out<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">println<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u041e\u0442\u043a\u0430\u0437: \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">e<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getMessage<\/span><span style=\"color: #ABB2BF\">());<\/span>\n<span style=\"color: #ABB2BF\">        }<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">System<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">out<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">println<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getOwner<\/span><span style=\"color: #ABB2BF\">() <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #98C379\">\": \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">acc<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getBalance<\/span><span style=\"color: #ABB2BF\">());<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n<span style=\"color: #ABB2BF\">}<\/span><\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">\u0410\u043d\u043d\u0430: 12000\n\u041e\u0442\u043a\u0430\u0437: \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432: \u0431\u0430\u043b\u0430\u043d\u0441 12000, \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043e 25000\n\u041e\u0442\u043a\u0430\u0437: amount &lt;= 0: -100\n\u0410\u043d\u043d\u0430: 12000\n<\/code><\/pre>\n<p>\u0427\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u00ab\u0434\u043e\u00bb:<\/p>\n<ul>\n<li>\u041f\u043e\u043b\u044f <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code>: \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u0438\u0445 \u043d\u0435 \u0432\u0438\u0434\u043d\u043e, \u043c\u0435\u043d\u044f\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430.<\/li>\n<li>\u041f\u0440\u0430\u0432\u0438\u043b\u043e \u00ab\u0431\u0430\u043b\u0430\u043d\u0441 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0443\u043b\u044f\u00bb \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 &#8212; \u0432 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">withdraw<\/code>. \u0415\u0433\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u044b\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/li>\n<li>\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u044e\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c, \u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0436\u043d\u0438\u043c: \u043f\u043e\u0441\u043b\u0435 \u0434\u0432\u0443\u0445 \u043e\u0442\u043a\u0430\u0437\u043e\u0432 \u0431\u0430\u043b\u0430\u043d\u0441 \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 12000.<\/li>\n<li><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">owner<\/code> \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">final<\/code> \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435: \u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">null<\/code> \u043d\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438, \u043d\u0438 \u043f\u043e\u0442\u043e\u043c.<\/li>\n<li><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">Math.addExact<\/code> \u0431\u0440\u043e\u0441\u0430\u0435\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">ArithmeticException<\/code> \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">long<\/code> \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u0438\u0445\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0432 \u043c\u0438\u043d\u0443\u0441.<\/li>\n<\/ul>\n<p>\u0421\u0443\u043c\u043c\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043f\u0435\u0439\u043a\u0430\u0445 \u0446\u0435\u043b\u044b\u043c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">long<\/code>, \u0430 \u043d\u0435 \u0432 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">double<\/code>: \u0443 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0439 \u0434\u0440\u043e\u0431\u0438 \u0431\u044b\u0432\u0430\u044e\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0443\u0447\u0435\u0431\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0441\u0447\u0435\u0442\u0430\u0445 \u0447\u0430\u0441\u0442\u043e \u0431\u0435\u0440\u0443\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">BigDecimal<\/code>.<\/p>\n<h2 id=\"s3\">\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a private-\u043f\u043e\u043b\u044e<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">main<\/code> \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0448\u0435 \u043f\u0435\u0440\u0435\u0434 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">acc.deposit(5_000);<\/code> \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">acc.balance = -1;<\/code>, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u0441\u043e\u0431\u0435\u0440\u0435\u0442\u0441\u044f:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">Main.java:45: error: balance has private access in Account\n        acc.balance = -1;\n           ^\n1 error\n<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0432\u044b\u0433\u043e\u0434\u0430: \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u043b\u043e\u0432\u0438\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u0430 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435. \u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 &#8212; \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 (<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">acc.withdraw(...)<\/code>) \u0438\u043b\u0438, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0435\u0442, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439.<\/p>\n<h2 id=\"s4\">\u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432 Java<\/h2>\n<p>\u0412 Java \u0447\u0435\u0442\u044b\u0440\u0435 \u0443\u0440\u043e\u0432\u043d\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u043e\u043b\u044f\u043c, \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u043c. \u0423\u0440\u043e\u0432\u0435\u043d\u044c \u0431\u0435\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 package-private (\u0434\u043e\u0441\u0442\u0443\u043f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0430\u043a\u0435\u0442\u0430).<\/p>\n<table>\n<thead>\n<tr>\n<th>\u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440<\/th>\n<th>\u0421\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0441<\/th>\n<th>\u0422\u043e\u0442 \u0436\u0435 \u043f\u0430\u043a\u0435\u0442<\/th>\n<th>\u041d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u0430\u043a\u0435\u0442\u0435<\/th>\n<th>\u041b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u0434<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code><\/td>\n<td>\u0434\u0430<\/td>\n<td>\u043d\u0435\u0442<\/td>\n<td>\u043d\u0435\u0442<\/td>\n<td>\u043d\u0435\u0442<\/td>\n<\/tr>\n<tr>\n<td>\u0431\u0435\u0437 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 (package-private)<\/td>\n<td>\u0434\u0430<\/td>\n<td>\u0434\u0430<\/td>\n<td>\u043d\u0435\u0442<\/td>\n<td>\u043d\u0435\u0442<\/td>\n<\/tr>\n<tr>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">protected<\/code><\/td>\n<td>\u0434\u0430<\/td>\n<td>\u0434\u0430<\/td>\n<td>\u0434\u0430, \u0441 \u043e\u0433\u043e\u0432\u043e\u0440\u043a\u043e\u0439<\/td>\n<td>\u043d\u0435\u0442<\/td>\n<\/tr>\n<tr>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">public<\/code><\/td>\n<td>\u0434\u0430<\/td>\n<td>\u0434\u0430<\/td>\n<td>\u0434\u0430<\/td>\n<td>\u0434\u0430<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u0414\u0432\u0430 \u043c\u0435\u0441\u0442\u0430, \u0433\u0434\u0435 \u043f\u0443\u0442\u0430\u044e\u0442\u0441\u044f \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e:<\/p>\n<ul>\n<li><strong><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">protected<\/code> \u0432 Java \u0448\u0438\u0440\u0435, \u0447\u0435\u043c \u043a\u0430\u0436\u0435\u0442\u0441\u044f.<\/strong> \u041e\u043d \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0447\u043b\u0435\u043d \u0432\u0441\u0435\u043c\u0443 \u043f\u0430\u043a\u0435\u0442\u0443, \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430\u043c. \u041d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u0432\u0438\u0434\u0438\u0442 \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">this<\/code> \u0438\u043b\u0438 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u0432\u043e\u0439 \u0442\u0438\u043f, \u043d\u043e \u043d\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430.<\/li>\n<li><strong>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 &#8212; \u043d\u0435 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code>.<\/strong> \u041f\u043e\u043b\u0435 \u0431\u0435\u0437 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0432\u0438\u0434\u043d\u043e \u0432\u0441\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0442\u043e\u0433\u043e \u0436\u0435 \u043f\u0430\u043a\u0435\u0442\u0430.<\/li>\n<\/ul>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0434\u0432\u0443\u0445 \u043f\u0430\u043a\u0435\u0442\u0430\u0445:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">package<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">shop.core<\/span><span style=\"color: #ABB2BF\">;<\/span>\n\n<span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">class<\/span> <span style=\"color: #E5C07B\">Price<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">private<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">long<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">kopecks<\/span><span style=\"color: #ABB2BF\">;          <\/span><span style=\"color: #7F848E\">\/\/ \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E5C07B\">long<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">cachedTotal<\/span><span style=\"color: #ABB2BF\">;              <\/span><span style=\"color: #7F848E\">\/\/ package-private: \u0432\u0435\u0441\u044c \u043f\u0430\u043a\u0435\u0442 shop.core<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">protected<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">currency<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #98C379\">\"RUB\"<\/span><span style=\"color: #ABB2BF\">; <\/span><span style=\"color: #7F848E\">\/\/ \u043f\u0430\u043a\u0435\u0442 shop.core + \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0438<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">long<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">rubles<\/span><span style=\"color: #ABB2BF\">() { <\/span><span style=\"color: #C678DD\">return<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">kopecks<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">\/<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">100<\/span><span style=\"color: #ABB2BF\">; } <\/span><span style=\"color: #7F848E\">\/\/ \u0432\u0441\u0435\u043c<\/span>\n<span style=\"color: #ABB2BF\">}<\/span><\/code><\/pre>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">package<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">shop.app<\/span><span style=\"color: #ABB2BF\">;<\/span>\n\n<span style=\"color: #C678DD\">import<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">shop.core.Price<\/span><span style=\"color: #ABB2BF\">;<\/span>\n\n<span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">class<\/span> <span style=\"color: #E5C07B\">App<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">static<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">void<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">main<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #56B6C2\">[]<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">args<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">Price<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">p<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">Price<\/span><span style=\"color: #ABB2BF\">();<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">System<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">out<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">println<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">p<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">rubles<\/span><span style=\"color: #ABB2BF\">());<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">System<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">out<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">println<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">p<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">cachedTotal<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n<span style=\"color: #ABB2BF\">}<\/span><\/code><\/pre>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">javac -d out shop\/core\/Price.java shop\/app\/App.java<\/code> \u0434\u0430\u0435\u0442:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">shop\/app\/App.java:9: error: cachedTotal is not public in Price; cannot be accessed from outside package\n        System.out.println(p.cachedTotal);\n                            ^\n1 error\n<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">public<\/code> \u0438 package-private. \u041c\u043e\u0434\u0443\u043b\u0438 Java (\u0441 Java 9) \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0433\u0440\u0430\u043d\u0438\u0446\u0443: <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">public<\/code>-\u043a\u043b\u0430\u0441\u0441 \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0435 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0432 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">module-info.java<\/code>, \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u0440\u0443\u0433\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u044f\u043c.<\/p>\n<p>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432\u044b\u0431\u043e\u0440\u0430: \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u0443\u0437\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f (<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code>) \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c, \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/p>\n<h2 id=\"s5\">\u0413\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b: \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b, \u0430 \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0442<\/h2>\n<p><strong>\u0413\u0435\u0442\u0442\u0435\u0440<\/strong> (<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">getBalance()<\/code>) \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f, <strong>\u0441\u0435\u0442\u0442\u0435\u0440<\/strong> (<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setBalance(long)<\/code>) \u0435\u0433\u043e \u043c\u0435\u043d\u044f\u0435\u0442. \u0418\u043c\u0435\u043d\u0430 \u043f\u043e \u0441\u0445\u0435\u043c\u0435 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">getX<\/code>\/<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setX<\/code>\/<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">isX<\/code> &#8212; \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 JavaBeans, \u043d\u0430 \u043d\u0435\u0433\u043e \u043e\u043f\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438.<\/p>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u0430\u0440\u0430 \u0433\u0435\u0442\u0442\u0435\u0440 + \u0441\u0435\u0442\u0442\u0435\u0440 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u043f\u043e\u043b\u0435 &#8212; \u043d\u0435 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f. \u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435:<\/p>\n<table>\n<thead>\n<tr>\n<th>\u0412\u0430\u0440\u0438\u0430\u043d\u0442<\/th>\n<th>\u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c?<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">public long balance;<\/code><\/td>\n<td>\u0434\u0430<\/td>\n<\/tr>\n<tr>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private long balance;<\/code> + <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">setBalance(long v) { balance = v; }<\/code><\/td>\n<td>\u0434\u0430<\/td>\n<\/tr>\n<tr>\n<td><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private long balance;<\/code> + <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">withdraw(long)<\/code> \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439<\/td>\n<td>\u043d\u0435\u0442<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u041a\u0430\u043a \u0440\u0435\u0448\u0430\u0442\u044c:<\/p>\n<ol>\n<li>\u0421\u043f\u0440\u043e\u0441\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0443\u0436\u043d\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u043f\u043e \u0441\u043c\u044b\u0441\u043b\u0443: \u00ab\u043f\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c\u00bb, \u00ab\u0441\u043f\u0438\u0441\u0430\u0442\u044c\u00bb, \u00ab\u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438\u00bb, \u0430 \u043d\u0435 \u00ab\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441\u00bb.<\/li>\n<li>\u0413\u0435\u0442\u0442\u0435\u0440 \u0434\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u0430\u0440\u0443\u0436\u0438.<\/li>\n<li>\u0421\u0435\u0442\u0442\u0435\u0440 &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e \u0441\u043c\u044b\u0441\u043b\u0443, \u0438 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0438.<\/li>\n<li>\u041f\u043e\u043b\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f, \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">final<\/code> \u0438 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435.<\/li>\n<li>\u0422\u0435 \u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0447\u0442\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0430\u0445, \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435, \u0438\u043d\u0430\u0447\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u043c.<\/li>\n<\/ol>\n<h2 id=\"s6\">\u0423\u0442\u0435\u0447\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u0433\u0435\u0442\u0442\u0435\u0440: \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438<\/h2>\n<p><code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code> \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443, \u043d\u043e \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043d\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442. \u0415\u0441\u043b\u0438 \u0433\u0435\u0442\u0442\u0435\u0440 \u043e\u0442\u0434\u0430\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">List<\/code>, \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043e\u0434 \u043c\u0435\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">import<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">java.util.ArrayList<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #C678DD\">import<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">java.util.List<\/span><span style=\"color: #ABB2BF\">;<\/span>\n\n<span style=\"color: #C678DD\">class<\/span> <span style=\"color: #E5C07B\">Course<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">private<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">final<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">List<\/span><span style=\"color: #56B6C2\">&lt;<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #56B6C2\">&gt;<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">students<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">ArrayList<\/span><span style=\"color: #56B6C2\">&lt;&gt;<\/span><span style=\"color: #ABB2BF\">();<\/span>\n\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">void<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">enroll<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">name<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">students<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">size<\/span><span style=\"color: #ABB2BF\">() <\/span><span style=\"color: #56B6C2\">&gt;=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">2<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #C678DD\">throw<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">IllegalStateException<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u043c\u0435\u0441\u0442 \u043d\u0435\u0442\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        }<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">students<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">add<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">name<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">List<\/span><span style=\"color: #56B6C2\">&lt;<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #56B6C2\">&gt;<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">getStudents<\/span><span style=\"color: #ABB2BF\">() {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">return<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">students<\/span><span style=\"color: #ABB2BF\">; <\/span><span style=\"color: #7F848E\">\/\/ \u043e\u0442\u0434\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">class<\/span> <span style=\"color: #E5C07B\">Main<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">static<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">void<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">main<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #56B6C2\">[]<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">args<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">Course<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">c<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">Course<\/span><span style=\"color: #ABB2BF\">();<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">c<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">enroll<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0410\u043d\u043d\u0430\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">c<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">enroll<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0411\u043e\u0440\u0438\u0441\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">c<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getStudents<\/span><span style=\"color: #ABB2BF\">().<\/span><span style=\"color: #E06C75\">add<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0412\u0435\u0440\u0430\"<\/span><span style=\"color: #ABB2BF\">); <\/span><span style=\"color: #7F848E\">\/\/ \u043b\u0438\u043c\u0438\u0442 \u043e\u0431\u043e\u0439\u0434\u0435\u043d \u0441\u043d\u0430\u0440\u0443\u0436\u0438<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">System<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">out<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">println<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">c<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getStudents<\/span><span style=\"color: #ABB2BF\">());<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n<span style=\"color: #ABB2BF\">}<\/span><\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 &#8212; \u0442\u0440\u0438 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u043b\u0438\u043c\u0438\u0442\u0435 \u0432 \u0434\u0432\u0430:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">[\u0410\u043d\u043d\u0430, \u0411\u043e\u0440\u0438\u0441, \u0412\u0435\u0440\u0430]\n<\/code><\/pre>\n<p>\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 &#8212; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u0443\u044e \u043a\u043e\u043f\u0438\u044e: <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">return List.copyOf(students);<\/code>. \u0422\u043e\u0433\u0434\u0430 \u0432\u044b\u0437\u043e\u0432 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">c.getStudents().add(\"\u0412\u0435\u0440\u0430\")<\/code> \u0431\u0440\u043e\u0441\u0430\u0435\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">UnsupportedOperationException<\/code>, \u0438 \u043f\u0440\u043e\u0433\u043e\u043d \u0441 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">\u0421\u043d\u0430\u0440\u0443\u0436\u0438 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c: UnsupportedOperationException\n[\u0410\u043d\u043d\u0430, \u0411\u043e\u0440\u0438\u0441]\n<\/code><\/pre>\n<p>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 &#8212; <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">Collections.unmodifiableList(students)<\/code>: \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043e\u043d\u043e \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043d\u0430\u0440\u0443\u0436\u0438, \u043d\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u0443\u0434\u0443\u0449\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430. \u0422\u043e \u0436\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">java.util.Date<\/code>: \u0438\u0445 \u0442\u043e\u0436\u0435 \u043e\u0442\u0434\u0430\u044e\u0442 \u043a\u043e\u043f\u0438\u0435\u0439.<\/p>\n<h2 id=\"s7\">\u041d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 record<\/h2>\n<p>\u0421\u0430\u043c\u0430\u044f \u0441\u0438\u043b\u044c\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u0438 &#8212; \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f. \u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0435\u0446\u0435\u043f\u0442: \u043a\u043b\u0430\u0441\u0441 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">final<\/code>, \u0432\u0441\u0435 \u043f\u043e\u043b\u044f <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private final<\/code>, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435, \u0441\u0435\u0442\u0442\u0435\u0440\u043e\u0432 \u043d\u0435\u0442, \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0438 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435.<\/p>\n<p>\u0421 Java 16 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">record<\/code>: \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private final<\/code>-\u043f\u043e\u043b\u044f, \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">title()<\/code>, \u0430 \u043d\u0435 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">getTitle()<\/code>), <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">equals<\/code>, <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">hashCode<\/code> \u0438 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">toString<\/code>. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043b\u0430\u0434\u0443\u0442 \u0432 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">import<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">java.util.ArrayList<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #C678DD\">import<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">java.util.List<\/span><span style=\"color: #ABB2BF\">;<\/span>\n\n<span style=\"color: #C678DD\">record<\/span> <span style=\"color: #E5C07B\">Group<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">title<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E06C75\">List<\/span><span style=\"color: #56B6C2\">&lt;<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #56B6C2\">&gt;<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">students<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">Group<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">if<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">title<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">==<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">null<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">||<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">title<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">isBlank<\/span><span style=\"color: #ABB2BF\">()) {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #C678DD\">throw<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">IllegalArgumentException<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"title \u043f\u0443\u0441\u0442\u043e\u0439\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        }<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">students<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">List<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">copyOf<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">students<\/span><span style=\"color: #ABB2BF\">); <\/span><span style=\"color: #7F848E\">\/\/ \u0437\u0430\u0449\u0438\u0442\u043d\u0430\u044f \u043a\u043e\u043f\u0438\u044f, \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u0430\u044f<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">class<\/span> <span style=\"color: #E5C07B\">Main<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">static<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">void<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">main<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #56B6C2\">[]<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">args<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">List<\/span><span style=\"color: #56B6C2\">&lt;<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #56B6C2\">&gt;<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">names<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">ArrayList<\/span><span style=\"color: #56B6C2\">&lt;&gt;<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">List<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">of<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0410\u043d\u043d\u0430\"<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #98C379\">\"\u0411\u043e\u0440\u0438\u0441\"<\/span><span style=\"color: #ABB2BF\">));<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">Group<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">g<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">Group<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"Java-1\"<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #E06C75\">names<\/span><span style=\"color: #ABB2BF\">);<\/span>\n\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">names<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">add<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0412\u0435\u0440\u0430\"<\/span><span style=\"color: #ABB2BF\">); <\/span><span style=\"color: #7F848E\">\/\/ \u043c\u0435\u043d\u044f\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">System<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">out<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">println<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">g<\/span><span style=\"color: #ABB2BF\">);<\/span>\n\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #C678DD\">try<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #E06C75\">g<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">students<\/span><span style=\"color: #ABB2BF\">().<\/span><span style=\"color: #E06C75\">add<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0413\u043b\u0435\u0431\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        } <\/span><span style=\"color: #C678DD\">catch<\/span><span style=\"color: #ABB2BF\"> (<\/span><span style=\"color: #E06C75\">UnsupportedOperationException<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">e<\/span><span style=\"color: #ABB2BF\">) {<\/span>\n<span style=\"color: #ABB2BF\">            <\/span><span style=\"color: #E06C75\">System<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">out<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">println<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f: \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">e<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getClass<\/span><span style=\"color: #ABB2BF\">().<\/span><span style=\"color: #E06C75\">getSimpleName<\/span><span style=\"color: #ABB2BF\">());<\/span>\n<span style=\"color: #ABB2BF\">        }<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n<span style=\"color: #ABB2BF\">}<\/span><\/code><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">Group[title=Java-1, students=[\u0410\u043d\u043d\u0430, \u0411\u043e\u0440\u0438\u0441]]\n\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f: UnsupportedOperationException\n<\/code><\/pre>\n<p>\u0411\u0435\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">students = List.copyOf(students);<\/code> record \u0445\u0440\u0430\u043d\u0438\u043b \u0431\u044b \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0447\u0443\u0436\u043e\u0439 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u0438 \u00ab\u0412\u0435\u0440\u0430\u00bb \u043f\u043e\u043f\u0430\u043b\u0430 \u0431\u044b \u0432\u043d\u0443\u0442\u0440\u044c \u0433\u0440\u0443\u043f\u043f\u044b. <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">record<\/code> \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u043c\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0438 \u043f\u043e\u043b\u044f, \u0430 \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0438 \u0441\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f. \u0415\u0449\u0435 \u043e\u0434\u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430: <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">List.copyOf<\/code> \u0431\u0440\u043e\u0441\u0430\u0435\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">NullPointerException<\/code>, \u0435\u0441\u043b\u0438 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0435\u0441\u0442\u044c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">null<\/code>.<\/p>\n<h2 id=\"s8\">\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f &#8212; \u043d\u0435 \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0432\u0437\u043b\u043e\u043c\u0430<\/h2>\n<p>\u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0437\u0430\u0449\u0438\u0449\u0430\u044e\u0442 \u043e\u0442 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430, \u043d\u043e \u043d\u0435 \u043e\u0442 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u0430 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443. \u0427\u0435\u0440\u0435\u0437 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u044e <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code>-\u043f\u043e\u043b\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0439:<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\"><span style=\"color: #C678DD\">import<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">java.lang.reflect.Field<\/span><span style=\"color: #ABB2BF\">;<\/span>\n\n<span style=\"color: #C678DD\">class<\/span> <span style=\"color: #E5C07B\">Secret<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">private<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">int<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">pin<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #D19A66\">1234<\/span><span style=\"color: #ABB2BF\">;<\/span>\n<span style=\"color: #ABB2BF\">}<\/span>\n\n<span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">class<\/span> <span style=\"color: #E5C07B\">Main<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #C678DD\">public<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #C678DD\">static<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E5C07B\">void<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #61AFEF; font-weight: bold\">main<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #56B6C2\">[]<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">args<\/span><span style=\"color: #ABB2BF\">) <\/span><span style=\"color: #C678DD\">throws<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">Exception<\/span><span style=\"color: #ABB2BF\"> {<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">Field<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">f<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">Secret<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">class<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getDeclaredField<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"pin\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">f<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">setAccessible<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E5C07B\">true<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">System<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">out<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">println<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"pin = \"<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">+<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">f<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getInt<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #C678DD\">new<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">Secret<\/span><span style=\"color: #ABB2BF\">()));<\/span>\n\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">Field<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">v<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\"> <\/span><span style=\"color: #E06C75\">String<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">class<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">getDeclaredField<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #98C379\">\"value\"<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">v<\/span><span style=\"color: #ABB2BF\">.<\/span><span style=\"color: #E06C75\">setAccessible<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E5C07B\">true<\/span><span style=\"color: #ABB2BF\">);<\/span>\n<span style=\"color: #ABB2BF\">    }<\/span>\n<span style=\"color: #ABB2BF\">}<\/span><\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">pin = 1234<\/code>. \u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0430\u0434\u0430\u0435\u0442: \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 JDK \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 (\u0441\u0442\u0440\u043e\u0433\u0430\u044f \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441 Java 16, \u0430 \u0441 Java 17 \u0435\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0441\u043b\u0430\u0431\u0438\u0442\u044c \u0444\u043b\u0430\u0433\u043e\u043c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">--illegal-access<\/code>; \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u044f\u0432\u043d\u044b\u0439 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">--add-opens<\/code>):<\/p>\n<pre style=\"background:#282c34;color:#abb2bf;border-radius:8px;padding:16px 20px;margin:20px 0;overflow-x:auto;font-size:14px;line-height:1.55;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\"><code style=\"background:none\">Exception in thread &quot;main&quot; java.lang.reflect.InaccessibleObjectException: Unable to make field private final byte[] java.lang.String.value accessible: module java.base does not &quot;opens java.lang&quot; to unnamed module @14dad5dc\n<\/code><\/pre>\n<p>\u0425\u0435\u0448 \u043f\u043e\u0441\u043b\u0435 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">@<\/code> \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443. \u0412\u044b\u0432\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438: \u043f\u0430\u0440\u043e\u043b\u0438, \u043a\u043b\u044e\u0447\u0438 \u0438 PIN-\u043a\u043e\u0434\u044b \u043d\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043b\u0435\u0436\u0430\u0442 \u0432 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code>-\u043f\u043e\u043b\u0435. \u0418\u0445 \u0437\u0430\u0449\u0438\u0449\u0430\u044e\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0432\u043d\u0435 \u043a\u043e\u0434\u0430, \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/p>\n<h2 id=\"s9\">\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<ul>\n<li>\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java = \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code>) + \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430; \u043e\u0434\u043d\u043e \u0431\u0435\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/li>\n<li>\u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b: <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code> &lt; package-private &lt; <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">protected<\/code> &lt; <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">public<\/code>; <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">protected<\/code> \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0447\u043b\u0435\u043d \u0435\u0449\u0435 \u0438 \u0432\u0441\u0435\u043c\u0443 \u043f\u0430\u043a\u0435\u0442\u0443.<\/li>\n<li>\u0413\u0435\u0442\u0442\u0435\u0440 \u0438 \u0441\u0435\u0442\u0442\u0435\u0440 \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">public<\/code>-\u043f\u043e\u043b\u044f; \u043b\u0443\u0447\u0448\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e \u0441\u043c\u044b\u0441\u043b\u0443 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438.<\/li>\n<li>\u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0442\u0434\u0430\u044e\u0442 \u043a\u043e\u043f\u0438\u0435\u0439 (<code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">List.copyOf<\/code>), \u0438\u043d\u0430\u0447\u0435 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code> \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0433\u0435\u0442\u0442\u0435\u0440.<\/li>\n<li>\u0414\u043b\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0443\u0434\u043e\u0431\u0435\u043d <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">record<\/code> \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u043c\u0438 \u0438 \u0437\u0430\u0449\u0438\u0442\u043d\u044b\u043c\u0438 \u043a\u043e\u043f\u0438\u044f\u043c\u0438 \u0432 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435.<\/li>\n<\/ul>\n<h2 id=\"s10\">\u0413\u0434\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \/ \u0441\u0432\u044f\u0437\u044c \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439<\/h2>\n<div class=\"oj-cta\" style=\"background:#fbf4e4;border-left:4px solid #c9962b;border-radius:8px;padding:16px 20px;margin:24px 0\">\n<p style=\"margin:0 0 8px\"><strong>\u041e\u0441\u0432\u043e\u0439\u0442\u0435 \u0442\u0435\u043c\u0443 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/strong><\/p>\n<p>\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0436\u0434\u043e\u043c Java-\u043f\u0440\u043e\u0435\u043a\u0442\u0435: \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, DTO, \u043a\u043b\u0430\u0441\u0441\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 API \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u041d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u0434\u0436\u0443\u043d\u043e\u0432 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u043e\u0441\u044f\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">protected<\/code> \u0438 package-private \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0435\u043c \u043f\u043b\u043e\u0445\u043e\u0439 \u0441\u0435\u0442\u0442\u0435\u0440 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439. \u0415\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u041e\u041e\u041f \u043d\u0430 Java \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0441 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u0438 \u0440\u0435\u0432\u044c\u044e \u043a\u043e\u0434\u0430, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043a\u0443\u0440\u0441 <a href=\"https:\/\/otus.ru\/lessons\/java-basic\/?int_article=inkapsulyaciya-v-java-prosto-o-slozhnom&amp;int_place=article&amp;int_variant=v1\">\u00abJava \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c\u00bb<\/a>. \u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442 \u043c\u043e\u0436\u043d\u043e \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 <a href=\"https:\/\/otus.ru\/events\/?int_article=inkapsulyaciya-v-java-prosto-o-slozhnom&amp;int_place=article&amp;int_variant=v1\">\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0443\u0440\u043e\u043a\u0430\u0445 Otus<\/a>.<\/p>\n<\/div>\n<p>\u041a\u0430\u043a \u0442\u043e\u0442 \u0436\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u0433\u0434\u0435 \u0435\u0441\u0442\u044c \u0443\u0440\u043e\u0432\u0435\u043d\u044c <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">internal<\/code> \u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0431\u043e\u0440\u043e\u043a, &#8212; \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u043e <a href=\"\/journal\/inkapsulyaciya-i-modifikatory-dostupa\/\">\u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044e \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432 C#<\/a>.<\/p>\n<h2 id=\"s11\">FAQ<\/h2>\n<p><strong>\u0427\u0435\u043c \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438?<\/strong><br \/>\n\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u0440\u0435\u0448\u0430\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0438\u0440\u0443 (\u0447\u0442\u043e \u043e\u043d \u0443\u043c\u0435\u0435\u0442), \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f &#8212; \u043a\u0430\u043a \u0441\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043d\u0435 \u0434\u0430\u0442\u044c \u043e\u0431\u043e\u0439\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u0435: \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0437\u0430\u0434\u0430\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e, <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">private<\/code>-\u043f\u043e\u043b\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0442 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044e.<\/p>\n<p><strong>\u041d\u0443\u0436\u043d\u043e \u043b\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0438\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Lombok?<\/strong><br \/>\nLombok \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438, \u043d\u043e \u0440\u0435\u0448\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">@Setter<\/code> \u043d\u0430 \u043f\u043e\u043b\u0435 \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u0442\u0430\u043a \u0436\u0435 \u043e\u043f\u0430\u0441\u0435\u043d, \u043a\u0430\u043a \u0440\u0443\u0447\u043d\u043e\u0439 \u0441\u0435\u0442\u0442\u0435\u0440 \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. \u0414\u043b\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">record<\/code>.<\/p>\n<p><strong>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c private \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440?<\/strong><br \/>\n\u0414\u0430. \u0422\u0430\u043a \u0434\u0435\u043b\u0430\u044e\u0442 \u043a\u043b\u0430\u0441\u0441\u044b \u0441 \u0444\u0430\u0431\u0440\u0438\u0447\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 (\u0443 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">Optional<\/code> \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0437\u0430\u043a\u0440\u044b\u0442, \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0447\u0435\u0440\u0435\u0437 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">Optional.of<\/code>), \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u044b \u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0432\u0440\u043e\u0434\u0435 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">Math<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <code style=\"background:#eef0f3;color:#24292f;border-radius:4px;padding:1px 5px;font-size:0.92em;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace\">new<\/code> \u0441\u043d\u0430\u0440\u0443\u0436\u0438.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java &#8212; \u044d\u0442\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u041e\u041e\u041f, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u043b\u0430\u0441\u0441 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u043e\u043b\u044f\u0445 (private) \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u0430 \u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430. \u0426\u0435\u043b\u044c &#8212; \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0432 \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u043d\u0430\u0440\u0443\u0436\u0438: \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u0430\u043d\u0441, \u043f\u0443\u0441\u0442\u043e\u0435 \u0438\u043c\u044f, \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430. \u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e: \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u043f\u043e\u043b\u044f \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0441\u043b\u0435: private-\u043f\u043e\u043b\u044f \u0438 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":4509,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[75],"class_list":["post-4508","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-polza","tag-java"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438: \u043a\u043b\u0430\u0441\u0441 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435, private-\u043f\u043e\u043b\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b, \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0443\u0442\u0435\u0447\u043a\u0430 \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 record.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"A. Pavlenko\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#article\",\"name\":\"\\u0418\\u043d\\u043a\\u0430\\u043f\\u0441\\u0443\\u043b\\u044f\\u0446\\u0438\\u044f \\u0432 Java: private, \\u0433\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b \\u0438 \\u0441\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b | Otus\",\"headline\":\"\\u0418\\u043d\\u043a\\u0430\\u043f\\u0441\\u0443\\u043b\\u044f\\u0446\\u0438\\u044f \\u0432 Java: private-\\u043f\\u043e\\u043b\\u044f, \\u0433\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b, \\u0441\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b \\u0438 \\u043f\\u0440\\u0438\\u043c\\u0435\\u0440 \\u0434\\u043e \\u0438 \\u043f\\u043e\\u0441\\u043b\\u0435\",\"author\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/author\\\/a-pavlenko\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/oj-1080x720-7-1.png\",\"width\":1080,\"height\":720},\"datePublished\":\"2026-09-24T09:00:00+00:00\",\"dateModified\":\"2026-09-25T15:28:45+00:00\",\"inLanguage\":\"ru-RU\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#webpage\"},\"articleSection\":\"\\u041f\\u043e\\u043b\\u0435\\u0437\\u043d\\u043e\\u0435, Java\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/otus.ru\\\/journal\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/category\\\/polza\\\/#listItem\",\"name\":\"\\u041f\\u043e\\u043b\\u0435\\u0437\\u043d\\u043e\\u0435\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/category\\\/polza\\\/#listItem\",\"position\":2,\"name\":\"\\u041f\\u043e\\u043b\\u0435\\u0437\\u043d\\u043e\\u0435\",\"item\":\"https:\\\/\\\/otus.ru\\\/journal\\\/category\\\/polza\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#listItem\",\"name\":\"\\u0418\\u043d\\u043a\\u0430\\u043f\\u0441\\u0443\\u043b\\u044f\\u0446\\u0438\\u044f \\u0432 Java: private-\\u043f\\u043e\\u043b\\u044f, \\u0433\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b, \\u0441\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b \\u0438 \\u043f\\u0440\\u0438\\u043c\\u0435\\u0440 \\u0434\\u043e \\u0438 \\u043f\\u043e\\u0441\\u043b\\u0435\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#listItem\",\"position\":3,\"name\":\"\\u0418\\u043d\\u043a\\u0430\\u043f\\u0441\\u0443\\u043b\\u044f\\u0446\\u0438\\u044f \\u0432 Java: private-\\u043f\\u043e\\u043b\\u044f, \\u0433\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b, \\u0441\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b \\u0438 \\u043f\\u0440\\u0438\\u043c\\u0435\\u0440 \\u0434\\u043e \\u0438 \\u043f\\u043e\\u0441\\u043b\\u0435\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/category\\\/polza\\\/#listItem\",\"name\":\"\\u041f\\u043e\\u043b\\u0435\\u0437\\u043d\\u043e\\u0435\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#organization\",\"name\":\"\\u041e\\u0442\\u0443\\u0441 \\u043e\\u043d\\u043b\\u0430\\u0439\\u043d-\\u043e\\u0431\\u0440\\u0430\\u0437\\u043e\\u0432\\u0430\\u043d\\u0438\\u0435\",\"description\":\"\\u0411\\u043b\\u043e\\u0433 \\u043f\\u0440\\u043e IT\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/\",\"telephone\":\"+74999389202\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/OTUS-journal-logo-180x180-1.png\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#organizationLogo\",\"width\":180,\"height\":180},\"image\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCetgtvy93o3i3CvyGXKFU3g\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/author\\\/a-pavlenko\\\/#author\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/author\\\/a-pavlenko\\\/\",\"name\":\"A. Pavlenko\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/13488c7d5b657aaaf1808afd398f71e0225df07dd94eb7e5fcdfc45feff43cb5?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"A. Pavlenko\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#webpage\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/\",\"name\":\"\\u0418\\u043d\\u043a\\u0430\\u043f\\u0441\\u0443\\u043b\\u044f\\u0446\\u0438\\u044f \\u0432 Java: private, \\u0433\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b \\u0438 \\u0441\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b | Otus\",\"description\":\"\\u0427\\u0442\\u043e \\u0442\\u0430\\u043a\\u043e\\u0435 \\u0438\\u043d\\u043a\\u0430\\u043f\\u0441\\u0443\\u043b\\u044f\\u0446\\u0438\\u044f \\u0432 Java \\u043f\\u0440\\u043e\\u0441\\u0442\\u044b\\u043c\\u0438 \\u0441\\u043b\\u043e\\u0432\\u0430\\u043c\\u0438: \\u043a\\u043b\\u0430\\u0441\\u0441 \\u0434\\u043e \\u0438 \\u043f\\u043e\\u0441\\u043b\\u0435, private-\\u043f\\u043e\\u043b\\u044f, \\u0433\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b \\u0438 \\u0441\\u0435\\u0442\\u0442\\u0435\\u0440\\u044b, \\u043c\\u043e\\u0434\\u0438\\u0444\\u0438\\u043a\\u0430\\u0442\\u043e\\u0440\\u044b \\u0434\\u043e\\u0441\\u0442\\u0443\\u043f\\u0430, \\u0443\\u0442\\u0435\\u0447\\u043a\\u0430 \\u0441\\u0441\\u044b\\u043b\\u043e\\u043a \\u0438 \\u043d\\u0435\\u0438\\u0437\\u043c\\u0435\\u043d\\u044f\\u0435\\u043c\\u044b\\u0435 record.\",\"inLanguage\":\"ru-RU\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/author\\\/a-pavlenko\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/author\\\/a-pavlenko\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/oj-1080x720-7-1.png\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#mainImage\",\"width\":1080,\"height\":720},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/inkapsulyaciya-v-java-prosto-o-slozhnom\\\/#mainImage\"},\"datePublished\":\"2026-09-24T09:00:00+00:00\",\"dateModified\":\"2026-09-25T15:28:45+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#website\",\"url\":\"https:\\\/\\\/otus.ru\\\/journal\\\/\",\"name\":\"OTUS \\u0416\\u0443\\u0440\\u043d\\u0430\\u043b - \\u0411\\u043b\\u043e\\u0433 \\u043f\\u0440\\u043e IT\",\"alternateName\":\"OTUS \\u0416\\u0443\\u0440\\u043d\\u0430\\u043b\",\"description\":\"\\u0411\\u043b\\u043e\\u0433 \\u043f\\u0440\\u043e IT\",\"inLanguage\":\"ru-RU\",\"publisher\":{\"@id\":\"https:\\\/\\\/otus.ru\\\/journal\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java: private, \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b | Otus","description":"\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438: \u043a\u043b\u0430\u0441\u0441 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435, private-\u043f\u043e\u043b\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b, \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0443\u0442\u0435\u0447\u043a\u0430 \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 record.","canonical_url":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#article","name":"\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java: private, \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b | Otus","headline":"\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java: private-\u043f\u043e\u043b\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b, \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435","author":{"@id":"https:\/\/otus.ru\/journal\/author\/a-pavlenko\/#author"},"publisher":{"@id":"https:\/\/otus.ru\/journal\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2022\/09\/oj-1080x720-7-1.png","width":1080,"height":720},"datePublished":"2026-09-24T09:00:00+00:00","dateModified":"2026-09-25T15:28:45+00:00","inLanguage":"ru-RU","mainEntityOfPage":{"@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#webpage"},"isPartOf":{"@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#webpage"},"articleSection":"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435, Java"},{"@type":"BreadcrumbList","@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/#listItem","position":1,"name":"Home","item":"https:\/\/otus.ru\/journal\/","nextItem":{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/category\/polza\/#listItem","name":"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435"}},{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/category\/polza\/#listItem","position":2,"name":"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435","item":"https:\/\/otus.ru\/journal\/category\/polza\/","nextItem":{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#listItem","name":"\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java: private-\u043f\u043e\u043b\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b, \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435"},"previousItem":{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#listItem","position":3,"name":"\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java: private-\u043f\u043e\u043b\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b, \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435","previousItem":{"@type":"ListItem","@id":"https:\/\/otus.ru\/journal\/category\/polza\/#listItem","name":"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435"}}]},{"@type":"Organization","@id":"https:\/\/otus.ru\/journal\/#organization","name":"\u041e\u0442\u0443\u0441 \u043e\u043d\u043b\u0430\u0439\u043d-\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435","description":"\u0411\u043b\u043e\u0433 \u043f\u0440\u043e IT","url":"https:\/\/otus.ru\/journal\/","telephone":"+74999389202","logo":{"@type":"ImageObject","url":"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2026\/04\/OTUS-journal-logo-180x180-1.png","@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#organizationLogo","width":180,"height":180},"image":{"@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#organizationLogo"},"sameAs":["https:\/\/www.youtube.com\/channel\/UCetgtvy93o3i3CvyGXKFU3g"]},{"@type":"Person","@id":"https:\/\/otus.ru\/journal\/author\/a-pavlenko\/#author","url":"https:\/\/otus.ru\/journal\/author\/a-pavlenko\/","name":"A. Pavlenko","image":{"@type":"ImageObject","@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/13488c7d5b657aaaf1808afd398f71e0225df07dd94eb7e5fcdfc45feff43cb5?s=96&d=mm&r=g","width":96,"height":96,"caption":"A. Pavlenko"}},{"@type":"WebPage","@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#webpage","url":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/","name":"\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java: private, \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b | Otus","description":"\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438: \u043a\u043b\u0430\u0441\u0441 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435, private-\u043f\u043e\u043b\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b, \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0443\u0442\u0435\u0447\u043a\u0430 \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 record.","inLanguage":"ru-RU","isPartOf":{"@id":"https:\/\/otus.ru\/journal\/#website"},"breadcrumb":{"@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#breadcrumblist"},"author":{"@id":"https:\/\/otus.ru\/journal\/author\/a-pavlenko\/#author"},"creator":{"@id":"https:\/\/otus.ru\/journal\/author\/a-pavlenko\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/otus.ru\/journal\/wp-content\/uploads\/2022\/09\/oj-1080x720-7-1.png","@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#mainImage","width":1080,"height":720},"primaryImageOfPage":{"@id":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/#mainImage"},"datePublished":"2026-09-24T09:00:00+00:00","dateModified":"2026-09-25T15:28:45+00:00"},{"@type":"WebSite","@id":"https:\/\/otus.ru\/journal\/#website","url":"https:\/\/otus.ru\/journal\/","name":"OTUS \u0416\u0443\u0440\u043d\u0430\u043b - \u0411\u043b\u043e\u0433 \u043f\u0440\u043e IT","alternateName":"OTUS \u0416\u0443\u0440\u043d\u0430\u043b","description":"\u0411\u043b\u043e\u0433 \u043f\u0440\u043e IT","inLanguage":"ru-RU","publisher":{"@id":"https:\/\/otus.ru\/journal\/#organization"}}]}},"aioseo_meta_data":{"post_id":"4508","title":"\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java: private, \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b | Otus","description":"\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438: \u043a\u043b\u0430\u0441\u0441 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435, private-\u043f\u043e\u043b\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b, \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0443\u0442\u0435\u0447\u043a\u0430 \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 record.","keywords":[],"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"aioseo-article-636399f734080","slug":"article","graphName":"Article","label":"\u0421\u0442\u0430\u0442\u044c\u044f","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":{"businessInfo":{"name":"","urls":{"website":"","aboutPage":"","contactPage":""},"address":{"line1":"","line2":"","zip":"","city":"","state":"","country":""},"contact":{"email":"","phone":"","fax":""},"ids":{"vatID":"","taxID":"","chamberID":""},"payment":{"priceIndication":"","currenciesAccepted":"","methodsAccepted":""},"areaServed":""},"openingHours":{"show":false,"closedLabel":"","open24h":false,"open24hLabel":"","open247":false,"use24hFormat":false,"twoSets":false,"timezone":"","hours":[]}},"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2022-09-02 21:08:12","updated":"2026-09-25 17:46:21","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/otus.ru\/journal\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/otus.ru\/journal\/category\/polza\/\" title=\"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435\">\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java: private-\u043f\u043e\u043b\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b, \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/otus.ru\/journal\/"},{"label":"\u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0435","link":"https:\/\/otus.ru\/journal\/category\/polza\/"},{"label":"\u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u0432 Java: private-\u043f\u043e\u043b\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b, \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435","link":"https:\/\/otus.ru\/journal\/inkapsulyaciya-v-java-prosto-o-slozhnom\/"}],"_links":{"self":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts\/4508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/comments?post=4508"}],"version-history":[{"count":3,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts\/4508\/revisions"}],"predecessor-version":[{"id":12934,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/posts\/4508\/revisions\/12934"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/media\/4509"}],"wp:attachment":[{"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/media?parent=4508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/categories?post=4508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/otus.ru\/journal\/wp-json\/wp\/v2\/tags?post=4508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}