Pages

Java Interview Questions

CoreJava:☒
1.What is static?
2.What is interface?
3.What is abstract class?
4.What is the difference between interface and abstract class?
5.Difference between HashMap and Hashtable?
6.Difference between List and Set?
7.Can we create object for abstract class?if not, why?
8.Whether we can declare class as static?
9.Polymorphism w.r.t variables and methods? Or overriding and overloading?
10.In what way we can sort the elements(default and custom sort) present in array and any of the collection objects?
11.How to generate random number in java?And also generate random numbers of format 'A23BC'?
12.Is it possible to call a protected data members of one package in another package? Similarly all other access modifiers and its data members scope from other packages?
13.What is thread?
14.Pre-increment/decrement and post-increment/decrement 
15.What is singleton class?
16.Explain List
17.Explain Set
18.Explain Map
19.Why strings are immutable?
20.What is exception?And its types?
21.What is checked and unchecked exception?
22.What is comparable and comparator?
23.All oops concepts in single program.Explain OOPS

☒Coding:☒
1.Write a java program
2.Print from 1 to 10 without using any loop
3.Reverse a string without using built in methods
4.Reverse each words in a sentence(string)without changing the order of words
5.Reverse a string without using any loop or built in function
6.Remove spaces from string without using replace()
7.Print occurrences of distinct letters present in string
8.Print the indexes of specificed letter in string
9.Print the returned indexes of 2 elements from an array[2,4,3,6,8,7] where addition of 2 elements is equal to target sum=7
10.Transpose a matrix using 2D array concept
11.Print the first repeated character from a string
Ex: abcdcba , output:c
12.Find whether the string is having unique characters or not
13.Write a program to remove duplicates from an array without using collection? (Note: new array shld have its size equal to unique number of elements present in given array)
14.Write a program to print fibonacci series
15.Find and print the maximum character present in string

✴️Core Java Concepts:
1. What are the main principles of Object-Oriented Programming (OOP)?
2. Explain the difference between == and equals() method in Java.
3. What is a ClassLoader in Java?
4. What is the difference between an abstract class and an interface?
5. What is a singleton class and how do you implement it?

✴️DataStructures Basic
1. How do you implement a linked list in Java?
2. Describe how a HashMap works in Java.
3. Write a program to reverse a string in Java.
4. How would you find the maximum value in an array?
5. Explain the concept of a binary search tree and write code to perform an in-order traversal.

✴️Multithreading and Concurrency
1. What is the difference between Runnable and Callable in Java?
2. Explain the synchronized keyword and its use cases.
3. What are the different ways to create a thread in Java?
4. What is a deadlock and how can it be prevented?
5. What is the volatile keyword in Java?

✴️Java Collections Framework
1. What is the difference between ArrayList and LinkedList?
2. How does a HashSet store elements (or any collection)?
3. Explain the differences between HashMap and TreeMap.
4. How would you sort a list of objects in Java?
5. What is the purpose of the ConcurrentHashMap class?

✴️Exception Handling
1. What are the different types of exceptions in Java?
2. Explain the use of try-catch-finally blocks.
3. How do you create a custom exception in Java?
4. What is the difference between throw and throws?
5. What is the try-with-resources statement in Java?

✴️Java 8 Features
1. What are lambda expressions in Java? Provide an example.
2. Explain the Stream API in Java 8.
3. What are default methods in interfaces?
4. What is a functional interface?
5. How do you use the Optional class?

✴️Design Patterns
1. What is the Singleton pattern and how do you implement it in Java?
2. Explain the Factory pattern with an example.
3. What is the Observer pattern and where is it used?
4. Describe the Decorator pattern and its use case.
5. What is the difference between the Proxy and Adapter patterns?

✴️Database Connectivity
1. How do you connect to a database using JDBC in Java?
2. What is a JDBC driver and how does it work?
3. Explain the difference between Statement and PreparedStatement in JDBC.
4. How do you handle transactions in JDBC?
5. What is the use of ResultSet in JDBC?

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.