{"@context":"http://schema.org","@type":"Question","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p","text":"Что будет выведено на экран в результате работы данного кода?\n\u003cpre\u003e\u003ccode class\u003d\"java\"\u003e\npublic class Test {\n    public static void main(String[] s) {\n        A a \u003d new B();\n        a.b();\n    }\n}\n\nclass A {\n    void a() {\n        System.out.println(\"A-a\");\n    }\n    \n    void b() {\n        System.out.println(\"A-b\");\n        a();\n    }\n}\n\nclass B extends A {\n    void a() {\n        System.out.println(\"B-a\");\n    }\n    \n    void b() {\n        System.out.println(\"B-b\");\n        super.b();\n    }\n}\n\u003c/code\u003e\u003c/pre\u003e","headline":"Что будет выведено на экран в результате работы данного кода?\n\u003cpre\u003e\u003ccode class\u003d\"java\"\u003e\npublic class Test {\n   ","learningResourceType":["programming test","programming course","programming question"],"isPartOf":{"@type":"Course","@id":"https://codegalaxy.io/courses/java-ru","url":"https://codegalaxy.io/courses/java-ru","name":"Java Quiz","description":"Java - объектно-ориентированный кросс-платформенный язык программирования, предназначенный для удобства чтения и интероперабельности. Java обычно читается как легкая и простая версия языка Си++. Тем не менее, Java может использоваться как полная версия для создания приложений, которые могут работать на всех платформах, поддерживающих Java, без необходимости перекомпиляции. В 2020 году Java является самым популярным языком программирования, с которым работают более 9 миллионов разработчиков. \u003cbr\u003e\nЭтот обучающий курс полностью посвящен \u003cstrong\u003eJava языку\u003c/strong\u003e, где вы можете проверить свои знания и ответить на \u003cstrong\u003e вопросы интервью по Java\u003c/strong\u003e. Вы ответите на теоретические и практические вопросы, которые проверяют ваши навыки на понимание \u003cstrong\u003e Java-кода\u003c/strong\u003e и поиска ошибок.\n\u003cbr\u003e\nВы можете вернуться к этому java курсу когда захотите, так как он постоянно обновляется и добавляются новые вопросы и задачки!\n\nПереведено с помощью www.DeepL.com/Translator (бесплатная версия)","provider":{"@type":"Organization","@id":"https://codegalaxy.io","name":"CodeGalaxy","logo":{"@type":"ImageObject","url":"https://codegalaxy.io/app/assets/images/g_code.png","height":"513","width":"513"},"description":"Project aimed to provide new ways in learning programming languages and preparing for the interview."},"image":{"@type":"ImageObject","url":"https://codegalaxy.io/app/assets/images/fb/16x9/share-java-ru.png","height":"630","width":"1200"}},"image":{"@type":"ImageObject","url":"https://codegalaxy.io/app/assets/images/fb/16x9/share-java-ru.png","height":"630","width":"1200"},"answerCount":5,"potentialAction":[{"@type":"AssessAction","object":{"@type":"Question","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p"}},{"@type":"ChooseAction","actionOption":[{"@type":"Answer","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19075","url":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19075","text":"B-b\u003cbr\u003e\nA-b\u003cbr\u003e\nA-a\n","dateCreated":"2020-02-06"},{"@type":"Answer","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19076","url":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19076","text":"B-b\u003cbr\u003e\nA-b\u003cbr\u003e\nB-a","dateCreated":"2020-02-06"},{"@type":"Answer","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19077","url":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19077","text":"A-b\u003cbr\u003e\nA-a\n","dateCreated":"2020-02-06"},{"@type":"Answer","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19078","url":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19078","text":"A-b\u003cbr\u003e\nB-a","dateCreated":"2020-02-06"}],"object":{"@type":"Answer","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19076","url":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19076","text":"B-b\u003cbr\u003e\nA-b\u003cbr\u003e\nB-a","dateCreated":"2020-02-06"}}],"audience":{"@type":"EducationalAudience","audienceType":["developers","programmers"],"educationalRole":["Specialist","Student"],"alternateName":"Java Programmers","name":"Java Developers","sameAs":["https://en.wikipedia.org/wiki/Programmer","https://en.wikipedia.org/wiki/Software_developer","https://en.wikipedia.org/wiki/Software_engineer","https://en.wikipedia.org/wiki/Web_developer"]},"dateCreated":"2020-02-06","acceptedAnswer":[{"@type":"Answer","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#js-expander-trigger","url":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#js-expander-trigger","text":"An object of class B, which contains overridden methods a() and b(), is created. Therefore, when referring to these methods, their overridden versions will be called. Roughly speaking, the sequence of actions may be described as follows:\n\u003cbr\u003e\n\u003cpre\u003e\u003ccode class\u003d\"java\"\u003e01. A a \u003d new B(); // instance of class B is created\n02. a.b(); // b() method is called. It is overridden in the current object\n// Overridden version is called (\"B-b\")\n03. super.b();  // b() method from superclass is called (\"A-b\")\n04. a(); // a() method is called. It is overridden in the current object.\n// Overridden version is called (\"B-a\")\n\u003c/code\u003e \u003c/pre\u003e","about":{"@type":"Question","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p"},"upvoteCount":1,"dateCreated":"2020-02-06"},{"@type":"Answer","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19076","url":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19076","text":"B-b\u003cbr\u003e\nA-b\u003cbr\u003e\nB-a","dateCreated":"2020-02-06","upvoteCount":1}],"suggestedAnswer":[{"@type":"Answer","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19075","url":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19075","text":"B-b\u003cbr\u003e\nA-b\u003cbr\u003e\nA-a\n","dateCreated":"2020-02-06","upvoteCount":0},{"@type":"Answer","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19077","url":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19077","text":"A-b\u003cbr\u003e\nA-a\n","dateCreated":"2020-02-06","upvoteCount":0},{"@type":"Answer","@id":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19078","url":"https://codegalaxy.io/courses/java-ru/questions/81d2c1c6f9cb421f8bd297645105e345/chto-budet-vyvedeno-na-ekran-v-rezultate-raboty-dannogo-koda-public-class-test-p#19078","text":"A-b\u003cbr\u003e\nB-a","dateCreated":"2020-02-06","upvoteCount":0}]}