Add office photos
Engaged Employer

LTIMindtree

3.8
based on 21.1k Reviews
Filter interviews by

10+ Globe Detective Agency Interview Questions and Answers

Updated 15 Jul 2024
Popular Designations

Q1. 3. How can we make a class immutable in java?

Ans.

To make a class immutable in Java, we need to follow certain guidelines.

  • Make the class final

  • Make all fields private and final

  • Do not provide setter methods

  • If the field is mutable, return a clone of it instead of the original object

  • Ensure that any mutable objects passed to the constructor are not modified outside the class

Add your answer

Q2. what is autoboxing and unboxing

Ans.

Autoboxing is the automatic conversion of primitive data types to their corresponding object wrapper classes.

  • Autoboxing is useful when working with collections that require objects instead of primitives.

  • Example: int i = 5; Integer j = i; //autoboxing

  • Unboxing is the opposite of autoboxing, where an object of a wrapper class is converted back to its corresponding primitive type.

  • Example: Integer j = 5; int i = j; //unboxing

Add your answer

Q3. Write a program to add numbers in harmonic series. (1+1/2+1/3+.....1/n)

Ans.

Program to add numbers in harmonic series (1+1/2+1/3+...+1/n)

  • Create a variable to store the sum

  • Use a loop to iterate through the series up to n

  • Add each term to the sum

  • Print the sum

Add your answer

Q4. 1. Difference between finally and static block?

Ans.

finally is used to execute a block of code after try-catch block, while static block is executed when class is loaded.

  • finally block is used to perform cleanup operations like closing database connections, file streams etc.

  • static block is used to initialize static variables or perform any other static initialization.

  • finally block is always executed whether an exception is thrown or not, while static block is executed only once when class is loaded.

  • finally block is always writt...read more

Add your answer
Discover Globe Detective Agency interview dos and don'ts from real experiences

Q5. Difference between arrayList and vector and Hashmap and hashtable?

Ans.

ArrayList and Vector are similar but Vector is synchronized while HashMap and HashTable are both key-value pair data structures but HashTable is synchronized.

  • ArrayList and Vector both implement List interface but Vector is thread-safe while ArrayList is not.

  • Vector is slower than ArrayList due to synchronization.

  • HashMap and HashTable both store key-value pairs but HashTable is thread-safe while HashMap is not.

  • HashMap allows null keys and values while HashTable does not.

  • HashMap...read more

Add your answer

Q6. what is typecasting UP AND DOWN

Ans.

Typecasting up and down refers to converting a variable of one data type to another data type of higher or lower precision.

  • Typecasting up involves converting a variable of lower precision to a variable of higher precision, such as converting an int to a double.

  • Typecasting down involves converting a variable of higher precision to a variable of lower precision, such as converting a double to an int.

  • Typecasting can result in loss of data or precision.

  • Typecasting can be done imp...read more

Add your answer
Are these interview questions helpful?

Q7. What are new features in Java 8 explain in brief

Ans.

Java 8 introduced new features like lambda expressions, functional interfaces, streams, and default methods.

  • Lambda expressions allow you to write code in a more concise and readable way.

  • Functional interfaces provide a single abstract method for functional programming.

  • Streams enable processing sequences of elements in a functional style.

  • Default methods allow interfaces to have method implementations.

  • Example: Lambda expression - (a, b) -> a + b

  • Example: Functional interface - Co...read more

Add your answer

Q8. 4. What are collections in java?

Ans.

Collections are data structures that store and manipulate groups of objects.

  • Collections provide a way to manage and manipulate groups of objects

  • Java provides several built-in collection classes such as ArrayList, LinkedList, HashSet, etc.

  • Collections can be used to perform operations like searching, sorting, filtering, etc.

  • Collections can store objects of any type, including primitive types and user-defined classes

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. 2. Use of @autowired annotation in spring?

Ans.

The @Autowired annotation in Spring is used to automatically wire dependencies into a bean.

  • It eliminates the need for manual wiring of dependencies

  • It can be used to inject dependencies into constructors, fields, and methods

  • It can be used with other annotations like @Qualifier and @Value

  • It can be used with both XML and Java-based configurations

Add your answer

Q10. how do you iterate map

Ans.

To iterate a map in Java, use a for-each loop or an iterator.

  • Use the entrySet() method to get a set of key-value pairs

  • For-each loop: for(Map.Entry entry : map.entrySet())

  • Iterator: Iterator> iterator = map.entrySet().iterator();

  • Use hasNext() and next() methods to iterate through the map

Add your answer

Q11. types of synchronisation in java

Ans.

Types of synchronization in Java

  • Synchronized methods

  • Synchronized statements

  • ReentrantLock

  • Semaphore

  • CountDownLatch

Add your answer

Q12. access modifiers in method overriding

Ans.

Access modifiers in method overriding

  • Access modifiers in the overriding method cannot be more restrictive than the overridden method

  • The access modifier can be less restrictive or the same as the overridden method

  • Private methods cannot be overridden

  • Examples: public method can be overridden by public or protected method, but not by private method

Add your answer

Q13. What is Rest Api?

Ans.

Rest Api is a web service that uses HTTP methods to access and manipulate data.

  • Rest stands for Representational State Transfer

  • It is an architectural style for building web services

  • Uses HTTP methods like GET, POST, PUT, DELETE

  • Data is transferred in JSON or XML format

  • Examples: Twitter API, Facebook Graph API

Add your answer

Q14. spring vs spring boot

Ans.

Spring is a framework for building Java applications, while Spring Boot is a tool for quickly creating standalone Spring-based applications.

  • Spring is a comprehensive framework for building Java applications, providing support for various modules like Spring MVC, Spring Security, and Spring Data.

  • Spring Boot is a tool that simplifies the process of setting up and configuring a Spring application, by providing defaults and auto-configuration.

  • Spring Boot includes embedded servers...read more

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Globe Detective Agency

based on 5 interviews
2 Interview rounds
Technical Round - 1
Technical Round - 2
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Java Developer Interview Questions from Similar Companies

3.7
 • 193 Interview Questions
3.6
 • 164 Interview Questions
3.8
 • 35 Interview Questions
3.7
 • 18 Interview Questions
3.5
 • 18 Interview Questions
3.7
 • 11 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter