Java | Вопросы собесов
Cайт easyoffer.ru Реклама @easyoffer_adv ВП @easyoffer_vp Тесты t.me/+icUwivvbGOkwNWRi Задачи t.me/+8eqUTboisnkyZjQy Вакансии t.me/+4pspF5nDjgM4MjQy
Show more📈 Analytical overview of Telegram channel Java | Вопросы собесов
Channel Java | Вопросы собесов (@easy_java_ru) in the Russian language segment is an active participant. Currently, the community unites 11 455 subscribers, ranking 10 891 in the Technologies & Applications category and 57 522 in the Russia region.
📊 Audience metrics and dynamics
Since its creation on невідомо, the project has demonstrated rapid growth, gathering an audience of 11 455 subscribers.
According to the latest data from 08 June, 2026, the channel demonstrates stable activity. Although there has been a change in the number of participants by 11 over the last 30 days and by 7 over the last 24 hours, overall reach remains high.
- Verification status: Not verified
- Engagement rate (ER): The average audience engagement rate is 10.52%. Within the first 24 hours after publication, content typically collects 7.55% reactions from the total number of subscribers.
- Post reach: On average, each post receives 1 205 views. Within the first day, a publication typically gains 865 views.
- Reactions and interaction: The audience actively supports content: the average number of reactions per post is 7.
- Thematic interests: Content is focused on key topics such as ставь, void, string, строка, static.
📝 Description and content policy
The author describes the resource as a platform for expressing subjective opinions:
“Cайт easyoffer.ru
Реклама @easyoffer_adv
ВП @easyoffer_vp
Тесты t.me/+icUwivvbGOkwNWRi
Задачи t.me/+8eqUTboisnkyZjQy
Вакансии t.me/+4pspF5nDjgM4MjQy”
Thanks to the high frequency of updates (latest data received on 09 June, 2026), the channel maintains relevance and a high level of publication reach. Analytics show that the audience actively interacts with content, making it an important point of influence in the Technologies & Applications category.
clone() (реализация Cloneable)
class Person implements Cloneable {
String name;
public Person(String name) {
this.name = name;
}
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone(); // Поверхностное копирование
}
}
public class Main {
public static void main(String[] args) throws CloneNotSupportedException {
Person original = new Person("Иван");
Person copy = (Person) original.clone();
System.out.println(copy.name); // Иван
}
}
🟠Проблема с вложенными объектами (общие ссылки)
Если объект содержит вложенные объекты, они не копируются, а передаются по ссылке.
class Address {
String city;
public Address(String city) { this.city = city; }
}
class User implements Cloneable {
String name;
Address address;
public User(String name, Address address) {
this.name = name;
this.address = address;
}
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone(); // Поверхностное копирование
}
}
public class Main {
public static void main(String[] args) throws CloneNotSupportedException {
Address address = new Address("Москва");
User original = new User("Иван", address);
User copy = (User) original.clone();
copy.address.city = "Санкт-Петербург"; // Меняем адрес у копии
System.out.println(original.address.city); // Санкт-Петербург (изменилось и у оригинала!)
}
}
🟠Как сделать глубокую копию? (Deep Copy)
Решение: Создать новый вложенный объект в clone()
@Override
protected Object clone() throws CloneNotSupportedException {
User clonedUser = (User) super.clone();
clonedUser.address = new Address(this.address.city); // Копируем вложенный объект
return clonedUser;
}
Ставь 👍 и забирай 📚 Базу знаний@RequestMapping – универсальная аннотация, поддерживающая все HTTP-методы (GET, POST, PUT, DELETE и т. д.).
@PutMapping – специализированная аннотация для PUT-запросов.
🚩`@RequestMapping` – универсальная аннотация
Можно использовать для любого HTTP-метода (GET, POST, PUT, DELETE). Необходимо явно указывать method = RequestMethod.PUT, если нужен PUT.
@RestController
@RequestMapping("/users")
public class UserController {
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public String updateUser(@PathVariable Long id, @RequestBody String userData) {
return "Пользователь с ID " + id + " обновлён!";
}
}
🚩`@PutMapping` – упрощённый способ для `PUT`-запросов
Это специализированная аннотация, эквивалентная @RequestMapping(method = RequestMethod.PUT).
@RestController
@RequestMapping("/users")
public class UserController {
@PutMapping("/{id}")
public String updateUser(@PathVariable Long id, @RequestBody String userData) {
return "Пользователь с ID " + id + " обновлён!";
}
}
Ставь 👍 и забирай 📚 Базу знанийObject, поэтому эти методы важны для любой программы.
class Person {
String name;
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
Person person = (Person) obj;
return name.equals(person.name);
}
@Override
public int hashCode() {
return name.hashCode();
}
}
🟠Важные методы `String` (работа со строками)
Строки в Java неизменяемы, поэтому методы создают новые объекты.
String text = " Hello, Java! ";
System.out.println(text.trim().toUpperCase()); // "HELLO, JAVA!"
Важные методы List, Set, Map (коллекции)
List<String> names = new ArrayList<>();
names.add("Alice");
names.add("Bob");
System.out.println(names.get(0)); // Alice
Set<String> uniqueNames = new HashSet<>();
uniqueNames.add("Alice");
uniqueNames.add("Alice");
System.out.println(uniqueNames.size()); // 1 (дубликат не добавился)
🚩Методы `Map` (HashMap, TreeMap)
Map<String, Integer> ages = new HashMap<>();
ages.put("Alice", 25);
ages.put("Bob", 30);
System.out.println(ages.get("Alice")); // 25
Stream API позволяет работать с данными декларативно.
List<String> names = List.of("Alice", "Bob", "Charlie");
names.stream()
.filter(name -> name.startsWith("A"))
.map(String::toUpperCase)
.forEach(System.out::println);
Ставь 👍 и забирай 📚 Базу знанийintern() в классе String используется для оптимизации памяти.
Он добавляет строку в String Pool и возвращает её ссылку, если строка уже там есть.
🚩Как работает `intern()`?
Без intern() – строки создаются в Heap (куче)
String s1 = new String("Hello"); // В куче (Heap)
String s2 = new String("Hello");
System.out.println(s1 == s2); // false (разные объекты)
С intern() – строки хранятся в String Pool
String s1 = new String("Hello").intern();
String s2 = new String("Hello").intern();
System.out.println(s1 == s2); // true (одна строка в String Pool)
🚩Что такое `String Pool`?
Это специальная область памяти, где хранятся уникальные строковые литералы.
Все строковые литералы ("Hello") по умолчанию хранятся в String Pool.
String s1 = "Hello"; // В String Pool
String s2 = "Hello"; // Ссылается на тот же объект
System.out.println(s1 == s2); // true
🚩Когда использовать `intern()`?
Когда у вас много одинаковых строк в памяти (например, имена, идентификаторы).
Для экономии памяти, если строки часто дублируются.
В парсинге JSON, XML – одни и те же строки могут повторяться тысячи раз.
List<String> names = new ArrayList<>();
for (int i = 0; i < 100000; i++) {
names.add(("User" + (i % 100)).intern()); // Используем String Pool
}
Ставь 👍 и забирай 📚 Базу знаний@Component делает класс Spring-бином автоматически.
Spring сам создаст и зарегистрирует объект в контейнере.
import org.springframework.stereotype.Component;
@Component
public class Car {
public void drive() {
System.out.println("Машина едет...");
}
}
Как получить объект?
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
public class Main {
public static void main(String[] args) {
ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
Car car = context.getBean(Car.class);
car.drive();
}
}
🚩Что такое `@Bean`?
@Bean создаёт Bean вручную в @Configuration-классе.
Можно использовать, если нужно передать параметры или создать Bean из библиотеки.
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class AppConfig {
@Bean
public Car car() {
return new Car(); // Создаём объект вручную
}
}
Как получить Bean?
ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
Car car = context.getBean(Car.class);
Ставь 👍 и забирай 📚 Базу знаний
Available now! Telegram Research 2025 — the year's key insights 
