Typical java interview questions sorted by experience
Junior
* Name some of the characteristics of OO programming languages
* What are the access modifiers you know? What does each one do?
* What is the difference between overriding and overloading a method in Java?
* What’s the difference between an Interface and an abstract class?
* Can an Interface extend another Interface?
* What does the static word mean in Java?
* Can a static method be overridden in Java?
* What is Polymorphism? What about Inheritance?
* Can a constructor be inherited?
* Do objects get passed by reference or value in Java? Elaborate on that.
* What’s the difference between using == and .equals on a string?
* What is the hashCode() and equals() used for?
* What does the interface Serializable do? What about Parcelable in Android?
* Why are Array and ArrayList different? When would you use each?
* What’s the difference between an Integer and int?
* What is a ThreadPool? Is it better than using several “simple” threads?
* What the difference between local, instance and class variables?
Mid
* What is reflection?
* What is dependency injection? Can you name a few libraries? (Have you used any?)
* What are strong, soft and weak references in Java?
* What does the keyword synchronized mean?
* Can you have “memory leaks” on Java?
* Do you need to set references to null on Java/Android?
* What does it means to say that a String is immutable?
* What are transient and volatile modifiers?
* What is the finalize() method?
* How does the try{} finally{} works?
* What is the difference between instantiation and initialisation of an object?
* When is a static block run?
* Why are Generics are used in Java?
* Can you mention the design patterns you know? Which of those do you normally use?
* Can you mention some types of testing you know?
Senior
* How does Integer.parseInt() works?
* Do you know what is the “double check locking” problem?
* Do you know the difference between StringBuffer and StringBuilder?
* How is a StringBuilder implemented to avoid the immutable string allocation problem?
* What does Class.forName method do?
* What is Autoboxing and Unboxing?
* What’s the difference between an Enumeration and an Iterator?
* What is the difference between fail-fast and fail safe in Java?
* What is PermGen in Java?
* What is a Java priority queue?
* *s performance influenced by using the same number in different types: Int, Double and Float?
* What is the Java Heap?
* What is daemon thread?
* Can a dead thread be restarted?
Source: medium.
Junior
* Name some of the characteristics of OO programming languages
* What are the access modifiers you know? What does each one do?
* What is the difference between overriding and overloading a method in Java?
* What’s the difference between an Interface and an abstract class?
* Can an Interface extend another Interface?
* What does the static word mean in Java?
* Can a static method be overridden in Java?
* What is Polymorphism? What about Inheritance?
* Can a constructor be inherited?
* Do objects get passed by reference or value in Java? Elaborate on that.
* What’s the difference between using == and .equals on a string?
* What is the hashCode() and equals() used for?
* What does the interface Serializable do? What about Parcelable in Android?
* Why are Array and ArrayList different? When would you use each?
* What’s the difference between an Integer and int?
* What is a ThreadPool? Is it better than using several “simple” threads?
* What the difference between local, instance and class variables?
Mid
* What is reflection?
* What is dependency injection? Can you name a few libraries? (Have you used any?)
* What are strong, soft and weak references in Java?
* What does the keyword synchronized mean?
* Can you have “memory leaks” on Java?
* Do you need to set references to null on Java/Android?
* What does it means to say that a String is immutable?
* What are transient and volatile modifiers?
* What is the finalize() method?
* How does the try{} finally{} works?
* What is the difference between instantiation and initialisation of an object?
* When is a static block run?
* Why are Generics are used in Java?
* Can you mention the design patterns you know? Which of those do you normally use?
* Can you mention some types of testing you know?
Senior
* How does Integer.parseInt() works?
* Do you know what is the “double check locking” problem?
* Do you know the difference between StringBuffer and StringBuilder?
* How is a StringBuilder implemented to avoid the immutable string allocation problem?
* What does Class.forName method do?
* What is Autoboxing and Unboxing?
* What’s the difference between an Enumeration and an Iterator?
* What is the difference between fail-fast and fail safe in Java?
* What is PermGen in Java?
* What is a Java priority queue?
* *s performance influenced by using the same number in different types: Int, Double and Float?
* What is the Java Heap?
* What is daemon thread?
* Can a dead thread be restarted?
Source: medium.
❤4
Java Backend Development is a highly in-demand and well-paying job in the tech industry.
If you're looking to become an excellent Java Developer, here's a roadmap that includes various online resources:
1. Core Java
First comes the fundamentals of Java Programming, here you will understand OOP concepts, conditional statements, collection frameworks,and many more.
https://youtube.com/playlist?list=PLd3UqWTnYXOnjGmyjD3zbIkyLXP15-6w0&si=UYvQhVNlZQYCH1Il
2. JDBC
A Java API that allows you to access tabular data, especially data stored in a relational database.
https://youtube.com/playlist?list=PLsyeobzWxl7rU7Jz3zDRpqB-EODzBbHOI&si=Cc45vpeRXGIUKbfn
3. SQL
Get a good understanding of SQL, which is necessary to work with JDBC to write queries.
https://youtu.be/7S_tz1z_5bA
4. JSP + Servlet
Learn JSP and Servlet, which are used for writing web pages for web applications and handling client requests on the server-side.
https://youtube.com/playlist?list=PLE0F6C1917A427E96&si=TQeOIgluG3R29622
5. Spring Framework
5.1. Core Spring Framework
https://youtu.be/GB8k2-Egfv0?si=dHYp6rFkGVl9RMt8
5.2. Spring REST & Spring DATA
https://youtu.be/GwYUjzPrQTM?si=hJfmpukii2WnofxQ
5.3. Spring Security
Spring Security is the primary choice for implementing application-level security
https://youtu.be/sm-8qfMWEV8?si=uMkpBxOUXIptZif9
6. Hibernate Framework
Hibernate is a Java framework that simplifies the development of Java application to interact with the database. It is an open source, lightweight, ORM (Object Relational Mapping) tool.
https://youtu.be/Yv2xctJxE-w?si=q4FIOBxxX-Y0Qj5q
7. Spring Boot
Spring Boot is the ultimate framework and Makes Java Web Development less boilerplate, it can help you make production-ready applications in no time.
https://youtu.be/msXL2oDexqw?si=XB19MCCECAggcB18
8. Basic DevOps
8.1. Learn to Use AWS & Deploy Java Apps
https://youtube.com/playlist?list=PLVz2XdJiJQxxurKT1Dqz6rmiMuZNdClqv&si=bJyg0Np11PkGDIKO
8.2. Learn Basic Docker:
https://youtu.be/p28piYY_wv8?si=Xoqje7MJad1NeE9g
8.3. Learn Basic Kubernetes:
https://youtu.be/rTNR7vDQDD8?si=dgzwxQof7yGHUP4n
8.4. Deploy Spring Boot App on Kubernetes:
https://youtu.be/EZolJ4lNiYc?si=Kw09qKwMp_LxHTvw
9. Basic of git and GitHub
https://youtu.be/apGV9Kg7ics?si=MHtCgD8o7XqpU4W3
10. Java Microservices
https://youtu.be/tuJqH3AV0e8?si=1jjrWl4l4uYGrE5i
14. Java Quick revision for Interviews
https://youtu.be/oYXivKMSEqM?si=tngbZrvgbAwsShEb
15. Spring JMS(java messaging services)
JMS is a standard Java API that allows a Java application to send messages to another application.
https://youtube.com/playlist?list=PLmCsXDGbJHdibOx6axScPiuHA8ftsrmut&si=J0qjBSbB4GDCeTOv
𝐉𝐨𝐢𝐧 𝐭𝐡𝐢𝐬 𝐭𝐞𝐥𝐞𝐠𝐫𝐚𝐦 𝐠𝐫𝐨𝐮𝐩 𝐟𝐨𝐫 𝐩𝐫𝐞𝐦𝐢𝐮𝐦 Resources/Notes: https://t.iss.one/udacityfreecourse
If you're looking to become an excellent Java Developer, here's a roadmap that includes various online resources:
1. Core Java
First comes the fundamentals of Java Programming, here you will understand OOP concepts, conditional statements, collection frameworks,and many more.
https://youtube.com/playlist?list=PLd3UqWTnYXOnjGmyjD3zbIkyLXP15-6w0&si=UYvQhVNlZQYCH1Il
2. JDBC
A Java API that allows you to access tabular data, especially data stored in a relational database.
https://youtube.com/playlist?list=PLsyeobzWxl7rU7Jz3zDRpqB-EODzBbHOI&si=Cc45vpeRXGIUKbfn
3. SQL
Get a good understanding of SQL, which is necessary to work with JDBC to write queries.
https://youtu.be/7S_tz1z_5bA
4. JSP + Servlet
Learn JSP and Servlet, which are used for writing web pages for web applications and handling client requests on the server-side.
https://youtube.com/playlist?list=PLE0F6C1917A427E96&si=TQeOIgluG3R29622
5. Spring Framework
5.1. Core Spring Framework
https://youtu.be/GB8k2-Egfv0?si=dHYp6rFkGVl9RMt8
5.2. Spring REST & Spring DATA
https://youtu.be/GwYUjzPrQTM?si=hJfmpukii2WnofxQ
5.3. Spring Security
Spring Security is the primary choice for implementing application-level security
https://youtu.be/sm-8qfMWEV8?si=uMkpBxOUXIptZif9
6. Hibernate Framework
Hibernate is a Java framework that simplifies the development of Java application to interact with the database. It is an open source, lightweight, ORM (Object Relational Mapping) tool.
https://youtu.be/Yv2xctJxE-w?si=q4FIOBxxX-Y0Qj5q
7. Spring Boot
Spring Boot is the ultimate framework and Makes Java Web Development less boilerplate, it can help you make production-ready applications in no time.
https://youtu.be/msXL2oDexqw?si=XB19MCCECAggcB18
8. Basic DevOps
8.1. Learn to Use AWS & Deploy Java Apps
https://youtube.com/playlist?list=PLVz2XdJiJQxxurKT1Dqz6rmiMuZNdClqv&si=bJyg0Np11PkGDIKO
8.2. Learn Basic Docker:
https://youtu.be/p28piYY_wv8?si=Xoqje7MJad1NeE9g
8.3. Learn Basic Kubernetes:
https://youtu.be/rTNR7vDQDD8?si=dgzwxQof7yGHUP4n
8.4. Deploy Spring Boot App on Kubernetes:
https://youtu.be/EZolJ4lNiYc?si=Kw09qKwMp_LxHTvw
9. Basic of git and GitHub
https://youtu.be/apGV9Kg7ics?si=MHtCgD8o7XqpU4W3
10. Java Microservices
https://youtu.be/tuJqH3AV0e8?si=1jjrWl4l4uYGrE5i
14. Java Quick revision for Interviews
https://youtu.be/oYXivKMSEqM?si=tngbZrvgbAwsShEb
15. Spring JMS(java messaging services)
JMS is a standard Java API that allows a Java application to send messages to another application.
https://youtube.com/playlist?list=PLmCsXDGbJHdibOx6axScPiuHA8ftsrmut&si=J0qjBSbB4GDCeTOv
𝐉𝐨𝐢𝐧 𝐭𝐡𝐢𝐬 𝐭𝐞𝐥𝐞𝐠𝐫𝐚𝐦 𝐠𝐫𝐨𝐮𝐩 𝐟𝐨𝐫 𝐩𝐫𝐞𝐦𝐢𝐮𝐦 Resources/Notes: https://t.iss.one/udacityfreecourse
Telegram
Java Programming
Everything you need to learn Java Programming
Daily Java tutorials, coding challenges, OOP concepts, DSA in Java & more!
Perfect for beginners, CS students & job seekers.
Downloadable PDFs, cheat sheets, interview prep & projects
For ads: @coderfun
Daily Java tutorials, coding challenges, OOP concepts, DSA in Java & more!
Perfect for beginners, CS students & job seekers.
Downloadable PDFs, cheat sheets, interview prep & projects
For ads: @coderfun
❤6
Polymorphism in Java
📍 Polymorphism allows a single interface to be used for different types of actions.
📍 It is of two types:
Method Overloading (Compile-time Polymorphism)
Method Overriding (Runtime Polymorphism)
Method Overloading (Same method name, different parameters)
class MathOperations {
int add(int a, int b) {
return a + b;
}
double add(double a, double b) {
return a + b;
}
}
Method Overriding (Same method in parent and child class)
class Animal {
void makeSound() {
System.out.println("Animal makes a sound");
}
}
class Dog extends Animal {
void makeSound() {
System.out.println("Dog barks");
}
}
🔗 More Java Resources: https://whatsapp.com/channel/0029VamdH5mHAdNMHMSBwg1s
📍 Polymorphism allows a single interface to be used for different types of actions.
📍 It is of two types:
Method Overloading (Compile-time Polymorphism)
Method Overriding (Runtime Polymorphism)
Method Overloading (Same method name, different parameters)
class MathOperations {
int add(int a, int b) {
return a + b;
}
double add(double a, double b) {
return a + b;
}
}
Method Overriding (Same method in parent and child class)
class Animal {
void makeSound() {
System.out.println("Animal makes a sound");
}
}
class Dog extends Animal {
void makeSound() {
System.out.println("Dog barks");
}
}
🔗 More Java Resources: https://whatsapp.com/channel/0029VamdH5mHAdNMHMSBwg1s
❤3😍1
Java Data Structures & Algorithms Roadmap ☑️
Phase 1: Java Fundamentals (Essential!)
• Goal: Solidify your understanding of Java syntax and core concepts.
• Topics:
• Variables and Data Types: int, float, double, boolean, char, String
• Operators: Arithmetic, relational, logical, assignment
• Control Flow: if, else, switch, for, while, do-while loops
• Arrays: Single and multi-dimensional arrays
• Methods (Functions): Defining, calling, parameters, return types
• Object-Oriented Programming (OOP):
* Classes and Objects
* Encapsulation, Inheritance, Polymorphism
* Abstraction
* Interfaces and Abstract Classes
• Resources:
• Online Courses:
* Coursera: "Java Programming and Software Engineering Fundamentals" by Duke University
* Udemy: "Java Masterclass" by Tim Buchalka
* Codecademy: "Learn Java"
• Books:
* "Head First Java" by Kathy Sierra and Bert Bates
* "Effective Java" by Joshua Bloch
• Practice:
• Solve basic coding problems on platforms like HackerRank, LeetCode (easy problems), and CodingBat.
• Write small Java programs to practice each concept. (e.g., a calculator, a simple game, etc.)
Phase 2: Core Data Structures
• Goal: Learn the fundamental data structures and their implementations in Java.
• Data Structures:
• Arrays: Dynamic Arrays (using ArrayList in Java)
• Linked Lists: Singly, Doubly, Circular
• Stacks: LIFO (Last-In, First-Out)
• Queues: FIFO (First-In, First-Out)
• Hash Tables (HashMaps): Key-value pairs, collision handling
• Trees:
* Binary Trees
* Binary Search Trees (BST)
* Balanced Trees (AVL Trees, Red-Black Trees - Conceptually understand, not necessarily implement from scratch)
• Heaps: Min-Heap, Max-Heap
• Graphs:
* Representation: Adjacency Matrix, Adjacency List
• Resources:
• Online Courses:
* Coursera: "Data Structures and Algorithm Specialization" by University of California, San Diego
* Udemy: "Data Structures and Algorithms in Java" by Nathan Marz
• Books:
* "Data Structures and Algorithms in Java" by Robert Lafore
* "Introduction to Algorithms" by Thomas H. Cormen (Classic, more theoretical, but valuable)
• Practice:
• Implement each data structure from scratch (at least once).
• Solve problems using these data structures on LeetCode (easy and medium problems).
• Focus on understanding the time and space complexity of each operation.
Phase 3: Essential Algorithms
• Goal: Learn fundamental algorithms and their implementations.
• Algorithms:
• Sorting Algorithms:
* Bubble Sort, Insertion Sort, Selection Sort (Understand the basics)
* Merge Sort, Quick Sort (Key algorithms to know)
* Heap Sort
• Searching Algorithms:
* Linear Search
* Binary Search (Crucial!)
• Graph Algorithms:
* Breadth-First Search (BFS)
* Depth-First Search (DFS)
* Dijkstra's Algorithm (Shortest path)
* Minimum Spanning Tree (Kruskal's, Prim's - Conceptually understand)
• Recursion: Understand recursive thinking and implementations
• Dynamic Programming:
* Understand the concept of overlapping subproblems and optimal substructure.
* Solve classic DP problems (e.g., Fibonacci, Knapsack, Coin Change).
• Resources:
• Online Courses: (Same as Phase 2)
• Books: (Same as Phase 2)
• Websites:
* GeeksforGeeks: Excellent resource for algorithm explanations and code.
* Visualgo: Visualize algorithms in action!
• Practice:
• Implement each algorithm from scratch.
• Solve problems using these algorithms on LeetCode (medium and hard problems).
• Pay attention to algorithm efficiency (time and space complexity).
Phase 1: Java Fundamentals (Essential!)
• Goal: Solidify your understanding of Java syntax and core concepts.
• Topics:
• Variables and Data Types: int, float, double, boolean, char, String
• Operators: Arithmetic, relational, logical, assignment
• Control Flow: if, else, switch, for, while, do-while loops
• Arrays: Single and multi-dimensional arrays
• Methods (Functions): Defining, calling, parameters, return types
• Object-Oriented Programming (OOP):
* Classes and Objects
* Encapsulation, Inheritance, Polymorphism
* Abstraction
* Interfaces and Abstract Classes
• Resources:
• Online Courses:
* Coursera: "Java Programming and Software Engineering Fundamentals" by Duke University
* Udemy: "Java Masterclass" by Tim Buchalka
* Codecademy: "Learn Java"
• Books:
* "Head First Java" by Kathy Sierra and Bert Bates
* "Effective Java" by Joshua Bloch
• Practice:
• Solve basic coding problems on platforms like HackerRank, LeetCode (easy problems), and CodingBat.
• Write small Java programs to practice each concept. (e.g., a calculator, a simple game, etc.)
Phase 2: Core Data Structures
• Goal: Learn the fundamental data structures and their implementations in Java.
• Data Structures:
• Arrays: Dynamic Arrays (using ArrayList in Java)
• Linked Lists: Singly, Doubly, Circular
• Stacks: LIFO (Last-In, First-Out)
• Queues: FIFO (First-In, First-Out)
• Hash Tables (HashMaps): Key-value pairs, collision handling
• Trees:
* Binary Trees
* Binary Search Trees (BST)
* Balanced Trees (AVL Trees, Red-Black Trees - Conceptually understand, not necessarily implement from scratch)
• Heaps: Min-Heap, Max-Heap
• Graphs:
* Representation: Adjacency Matrix, Adjacency List
• Resources:
• Online Courses:
* Coursera: "Data Structures and Algorithm Specialization" by University of California, San Diego
* Udemy: "Data Structures and Algorithms in Java" by Nathan Marz
• Books:
* "Data Structures and Algorithms in Java" by Robert Lafore
* "Introduction to Algorithms" by Thomas H. Cormen (Classic, more theoretical, but valuable)
• Practice:
• Implement each data structure from scratch (at least once).
• Solve problems using these data structures on LeetCode (easy and medium problems).
• Focus on understanding the time and space complexity of each operation.
Phase 3: Essential Algorithms
• Goal: Learn fundamental algorithms and their implementations.
• Algorithms:
• Sorting Algorithms:
* Bubble Sort, Insertion Sort, Selection Sort (Understand the basics)
* Merge Sort, Quick Sort (Key algorithms to know)
* Heap Sort
• Searching Algorithms:
* Linear Search
* Binary Search (Crucial!)
• Graph Algorithms:
* Breadth-First Search (BFS)
* Depth-First Search (DFS)
* Dijkstra's Algorithm (Shortest path)
* Minimum Spanning Tree (Kruskal's, Prim's - Conceptually understand)
• Recursion: Understand recursive thinking and implementations
• Dynamic Programming:
* Understand the concept of overlapping subproblems and optimal substructure.
* Solve classic DP problems (e.g., Fibonacci, Knapsack, Coin Change).
• Resources:
• Online Courses: (Same as Phase 2)
• Books: (Same as Phase 2)
• Websites:
* GeeksforGeeks: Excellent resource for algorithm explanations and code.
* Visualgo: Visualize algorithms in action!
• Practice:
• Implement each algorithm from scratch.
• Solve problems using these algorithms on LeetCode (medium and hard problems).
• Pay attention to algorithm efficiency (time and space complexity).
Please open Telegram to view this post
VIEW IN TELEGRAM
❤7
Phase 4: Advanced Topics (Optional, Depending on Your Goals)
• Goal: Explore more advanced data structures and algorithms.
• Topics:
• Advanced Data Structures:
* Tries (Prefix Trees)
* Segment Trees
* Fenwick Trees (Binary Indexed Trees)
• Advanced Algorithms:
* Greedy Algorithms
* Backtracking
* Branch and Bound
* String Algorithms (e.g., Knuth-Morris-Pratt (KMP))
• Algorithm Design Techniques: Divide and Conquer, Dynamic Programming (more advanced problems)
• Resources:
• (Same as Phase 2 and 3, plus specific resources for each topic)
• Practice:
• Focus on LeetCode hard problems.
• Participate in coding competitions (e.g., Codeforces, Topcoder).
Phase 5: Practical Application & Project Building
• Goal: Apply your knowledge to solve real-world problems and build a portfolio.
• Projects:
• Implement a search engine: Use Tries or HashMaps for indexing.
• Build a recommendation system: Use graph algorithms or collaborative filtering.
• Create a pathfinding algorithm: Implement Dijkstra's or A* for a game or navigation app.
• Design a data compression algorithm: Use Huffman coding.
• Considerations:
• Choose projects that align with your interests.
• Focus on code quality, readability, and maintainability.
• Use version control (Git) to track your changes.
• Document your code and project design.
• Portfolio:
• Create a GitHub repository to showcase your projects.
• Write a blog or online profile to describe your work.
• Highlight your skills and experience on your resume and LinkedIn profile.
General Tips:
• Consistency is Key: Practice regularly, even if it's just for 30 minutes a day.
• Don't Be Afraid to Ask for Help: Join online communities, forums, and study groups.
• Focus on Understanding, Not Memorization: Memorizing code is useless if you don't understand the underlying concepts.
• Visualize: Draw diagrams and visualize data structures and algorithms to understand how they work.
• Test Your Code: Write unit tests to ensure your code is correct.
• Start Small, Build Up: Don't try to learn everything at once. Start with the basics and gradually increase the complexity.
ENJOY LEARNING💪
• Goal: Explore more advanced data structures and algorithms.
• Topics:
• Advanced Data Structures:
* Tries (Prefix Trees)
* Segment Trees
* Fenwick Trees (Binary Indexed Trees)
• Advanced Algorithms:
* Greedy Algorithms
* Backtracking
* Branch and Bound
* String Algorithms (e.g., Knuth-Morris-Pratt (KMP))
• Algorithm Design Techniques: Divide and Conquer, Dynamic Programming (more advanced problems)
• Resources:
• (Same as Phase 2 and 3, plus specific resources for each topic)
• Practice:
• Focus on LeetCode hard problems.
• Participate in coding competitions (e.g., Codeforces, Topcoder).
Phase 5: Practical Application & Project Building
• Goal: Apply your knowledge to solve real-world problems and build a portfolio.
• Projects:
• Implement a search engine: Use Tries or HashMaps for indexing.
• Build a recommendation system: Use graph algorithms or collaborative filtering.
• Create a pathfinding algorithm: Implement Dijkstra's or A* for a game or navigation app.
• Design a data compression algorithm: Use Huffman coding.
• Considerations:
• Choose projects that align with your interests.
• Focus on code quality, readability, and maintainability.
• Use version control (Git) to track your changes.
• Document your code and project design.
• Portfolio:
• Create a GitHub repository to showcase your projects.
• Write a blog or online profile to describe your work.
• Highlight your skills and experience on your resume and LinkedIn profile.
General Tips:
• Consistency is Key: Practice regularly, even if it's just for 30 minutes a day.
• Don't Be Afraid to Ask for Help: Join online communities, forums, and study groups.
• Focus on Understanding, Not Memorization: Memorizing code is useless if you don't understand the underlying concepts.
• Visualize: Draw diagrams and visualize data structures and algorithms to understand how they work.
• Test Your Code: Write unit tests to ensure your code is correct.
• Start Small, Build Up: Don't try to learn everything at once. Start with the basics and gradually increase the complexity.
ENJOY LEARNING
Please open Telegram to view this post
VIEW IN TELEGRAM
❤7