Sobes.tech

Can the implementation of a static method in a subclass be changed by overriding it?

Junior — Middle
324

Tell us about your knowledge and experience working with Java.

Junior — Middle
324

What is Docker?

Junior
324

What is localization in the context of software development?

Junior
324

What factors are affected by using CGLib when dynamically creating proxy objects?

Junior — Middle
324

Can you explain the mechanism of pessimistic resource locking in database management systems?

Junior — Middle
324

Can you explain the concept of contract testing and its role in microservices integration?

Junior — Middle
324

Can an enumerable type implement an interface in a programming language?

Junior — Middle
324

How to call a static method of an interface?

Middle
324

What are access modifiers in Java and what are they?

Junior
324

How to implement a function call for elements inside a collection that does not allow modifications

Junior — Middle
324

Where exactly in memory is the reference located if the variable is a reference type?

Junior — Middle
324

On which platform was your last project built?

Junior — Middle
324

Explain the working principle and purpose of the Decorator design pattern.

Junior — Middle
324

public class MoneyTransferService { /** * @param fromAccountId unique identifier of the user transferring funds * @param toAccountId unique identifier of the user receiving funds * @param amount transfer amount. Positive number */ @Transactional public void transferMoney(Long fromAccountId, Long toAccountId, BigDecimal amount) { if (amount.compareTo(BigDecimal.ZERO) <= 0) { throw new RuntimeException("Amount must be +"); } if (fromAccountId.equals(toAccountId)) { throw new RuntimeException("Account can't be the same"); } Long firstId = Math.min(fromAccountId, toAccountId); Long secondId = Math.max(fromAccountId, toAccountId); Account first = accountRepository.findByIdForUpdate(firstId) .orElseThrow(() -> new RuntimeException("Account not found")); Account second = accountRepository.findByIdForUpdate(secondId) .orElseThrow(() -> new RuntimeException("Account not found")); Account from = fromAccountId.equals(firstId) ? first : second; Account to = fromAccountId.equals(firstId) ? second : first; if (from.getBalance().compareTo(amount) < 0) { throw new RuntimeException("Balance is less 0"); } from.setBalance(from.getBalance().subtract(amount)); to.setBalance(from.getBalance().add(amount)); accountRepository.save(to); accountRepository.save(from); } } @Entity @Data public class Account { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private BigDecimal balance; }

324

How can you temporarily disable the execution of tests during a Maven project build?

Junior — Middle
324

Explain how memory allocation and management occur in the JVM in the event of an OutOfMemoryError.

Junior — Middle
324
/739