Blog Archives
1 6 7 8 9 10 11 12 13 14 28

04: What is wrong with this code? Java Collection & ConcurrentModificationException

Q9. What is wring with this code?

A9. throws a Runtime exception called “java.util.ConcurrentModificationException” The output will be:

Fix 1: Use iterator.remove() instead of collection.remove

Output:

Fix 2: Use java.util.… Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


05: 9 Spring Bean scopes interview Q&A

Q1. Does Spring dependency injection happen during compile time or runtime? A1. Runtime during creating an object. Q2. What is the difference between prototype scope and singleton scope? Which one is the default? A2. Singleton means single bean instance per IoC container, … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


05: Azure interview Q&As on Security

Q01. What is Azure Active Directory? A01 Azure Active Directory (i.e. AD) is a cloud-based identity and access management (i.e. IAM) solution that provides a centralised, secure, and scalable platform for managing identities, access control, … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


05: Debugging Hibernate & handling 4 common issues

#1. Enable Logging in your log4j.xml, log4j.properties, or myapp-logback.xml

In the log4j.properties file, you can enable Hibernate SQL logging as shown below

or in your log4j.xml or myapp-logback.xml as

You can then check your logs for the SQLs executed and the parameters passed.

Read more ›



05: ETL & ELT architecture interview Q&As

Q1. What is an ETL process? A1. ETL is a architectural style, and it stands for Extract, Transform and Load. Extract does the process of reading data from an input data source like file, database, etc. … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


05: Finding the 2nd highest number in an array in Java

Requirements gathering

  1. Does the array allow duplicates?
  2. If duplicates are allowed, then do you need to report duplicates? For example, in {2,4, 6, 3, 6, 5}, is 6 or 5 the second highest?

Analysis

  • If duplicates are not allowed, sort the array (Arrays.sort(…)) and get the second last element,

Read more ›



05: Is a palindrome – complete the given code

Q. Complete the method “isPalindrome(String str) ” which takes a “string” as an input to evaluate if the input is a palindrome?

A. A palindrome is a word, phrase, verse, or sentence that reads the same backward or forward. … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


05: Is it a valid binary search tree (BST) ?

Q. Write code test if a given tree is a binary search tree (i.e. BST)? A. A binary search tree (BST) is a binary tree where each node satisfies the following conditions: 1) key in any node is larger than the keys in all nodes in that node’s left subtree...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


05: Java 9 to 20 features interview Q&As – Sealed Classes & Interfaces

Q01: Why do you need sealed classes when you have the final modifier? A01: The final modifier on a class doesn’t allow anyone to extend it. What if you want to extend a class, but only allow it for some classes? … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


05: JMockit interview Q&As & examples on Partial Mocking with Expectations(Object..)

This extends Mockit interview Q&As & examples on @Injectable Vs @Mocked Vs @Capturing Vs @Tested. Why partial mocking? All methods that can be called on a mocked instance get mocked. This is appropriate for most tests, but in some situations we might need to select only certain methods to be...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


05: Kubernetes (i.e k8s) interview Q&As – Service Vs Ingress

Q01. What is a Service in Kubernetes? A01. A Kubernetes service is a logical abstraction for a deployed group of pods in a cluster that perform the same function. Why do you need a service object? Why do you need a service object in k8s when each pod gets its...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


05: Microservices Architecture design patterns & considerations interview Q&As – Part 4

This extends 04: Microservices Architecture design patterns & considerations interview Q&As – Part 3. 4. Observability patterns Microservices require various cross-cutting concerns such as metrics, reporting exceptions to an exception tracker, logging, distributed tracing, health checks, externalised configuration, and security. Additionally, a service may need to handle service discovery and...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


05: Mockito & PowerMock partially mocking private methods with @Spy

This extends Part 3: Mockito partially mocking with @Spy by making the method “processUser(int id)” as a private method. Mockito framework cannot mock “private” methods, hence the “PowerMock” framework is added to the pom.xml file Step 1: Add “PowerMock” … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


1 6 7 8 9 10 11 12 13 14 28

300+ Java Interview FAQs

Tutorials on Java & Big Data