Telegram Group & Telegram Channel
Вопрос с собеседования

Можно ли переопределить private или static метод в Java?

Ответ: Нет, переопределить private и static методы нельзя, так как они не участвуют в механизме полиморфизма.

private-методы недоступны за пределами класса, поэтому при совпадении имени в подклассе создаётся совершенно новый метод, не связанный с исходным.

static-методы привязаны к классу, а не к объекту, и при наследовании могут быть скрыты, но не переопределены, поскольку их вызов определяется на этапе компиляции, а не во время выполнения.


tags: #собеседование

📱 Java Developer | Чат
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/java_tg/2936
Create:
Last Update:

Вопрос с собеседования

Можно ли переопределить private или static метод в Java?

Ответ: Нет, переопределить private и static методы нельзя, так как они не участвуют в механизме полиморфизма.

private-методы недоступны за пределами класса, поэтому при совпадении имени в подклассе создаётся совершенно новый метод, не связанный с исходным.

static-методы привязаны к классу, а не к объекту, и при наследовании могут быть скрыты, но не переопределены, поскольку их вызов определяется на этапе компиляции, а не во время выполнения.


tags: #собеседование

📱 Java Developer | Чат

BY Java Developer


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/java_tg/2936

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

Importantly, that investor viewpoint is not new. It cycles in when conditions are right (and vice versa). It also brings the ineffective warnings of an overpriced market with it.Looking toward a good 2022 stock market, there is no apparent reason to expect these issues to change.

Telegram Gives Up On Crypto Blockchain Project

Durov said on his Telegram channel today that the two and a half year blockchain and crypto project has been put to sleep. Ironically, after leaving Russia because the government wanted his encryption keys to his social media firm, Durov’s cryptocurrency idea lost steam because of a U.S. court. “The technology we created allowed for an open, free, decentralized exchange of value and ideas. TON had the potential to revolutionize how people store and transfer funds and information,” he wrote on his channel. “Unfortunately, a U.S. court stopped TON from happening.”

telegram from de


Telegram Java Developer
FROM USA