A Long List of Java Questions

We found these questions from the internet and keeps on adding to the list.

To answer the question, you can go to the forum and answer under relavent topics. You may find answers for some of these questions already @ forum

 

Questions

  1. CORE JAVA BASICS

    1. Difference between JRE, JVM, JDK?

    2. Explain the basic flow structure of java execution environment (e.g. Role of Class loaders , Byte code verifiers, Security Managers ) 

    3. Why java is called as platform independent?

    4. What is byte code?

    5. What do mean by Objects and Classes?

    6. List down all access specifiers and explain there scope.

    7. List down all modifiers and there use (e.g. abstract , final)

    8. Why the main method is declared as public and static?

    9. Can we call the main method inside any other method?

    10. Explain System.out.println(). What are System, out and println here?

    11. What will happen if we execute the statement System.out.println(null)?

    12. List down difference between static members (variable and method), and instance members (variable and methods).

    13. What do u mean by static block?

    14. Differentiate between final, finally and finalize keywords in Java?

    15. What do you mean by Wrapper classes what is need of wrapper classes

    16. What do you mean by Auto boxing and  Auto unboxing

    17. Explain why all wrapper classes are declared as final.

    18. Explain the working structure of enhanced for loop.

    19. What do u mean by variable length argument?

    20. What do u mean by static import?

    21. Explain what is Inner class. Explain the usage an inner class.

    22. What does u mean by anonymous class?

  2. OBJECT ORIENTED

    1. Explain the OOP concepts :- Abstraction ,Encapsulation, Inheritance , Polymorphism?

    2. What do u mean by Binding What is difference between method overloading and overriding?

      1. What do mean by static polymorphism and dynamic polymorphism

    3. What do  you mean by static binding and dynamic binding /early binding and late binding

    4. Explain types of Inheritance in java? Does java support multiple inheritance? Explain.

    5. Explain  how to achieve Multiple inheritance in java

    6. While doing overriding of method is it possible to change a return type of method?  If Yes how if no why?

    7. Can we able to overload a static method?

    8. Can we able to override a static method?

    9. Can we able to override private method?

    10. What does u mean by abstract class and interface? 

      1. What are the differences between them?

      2. Explain situation where we should use abstract class and where we should use interface?

      3. Explain which one work faster.

    11. Can we declare an abstract class without any abstract methods?

    12. Can we declare an interface as abstract and/or final?

    13. What do you mean by Tagged or makeable interface? Give examples from Java.

    14. What do mean by casting? What is the difference between upward/implicit/automatic and downward /explicate/forcefully casting?

  3. EXCEPTIONS

    1. Explain the process of Exception Handling? Which one is best default Exception handling or user defines Exception handling? Why     

    2. What do you mean by Exception? Give any Example?

    3. Describe the exception hierarchy in Java (starting from Throwable)?

    4. What is difference  between Error Class And Exception Class

    5. What is difference between Checked  exception and UncheckedException?

    6. What does u mean by cascaded catch blocks?

    7. Is it compulsory to give finally block after try block

    8. Is it compulsory to give catch block after try block

    9. What is a use of throw and throws keyword  

    10. Explain rules in terms of exception while overriding methods?

    11. When will you use a checked exception and when will you use unchecked (or runtime) exception, if you are creating a new exception?

    12. Should you handle an Error, Exception and/or RuntimeException? Explain.\

  4. STRING RELATED

    1. Explain Why String class declares as final?

    2. Explain why String class is called immutable class

    3. Explain how to achieve mutable String?

    4. Explain difference between StringBuffer class and StringBuilder class. Explain the situation where we have to use StringBuffer class and where we have to use StringBuilder Class.

    5. Explain difference between “==” operator and equals() method with regarding String

    6. How is the hashCode method implemented in a String class?

    7. How is the hashCode method implemented in a Character class?

  5. FILES AND STREAMS

    1. What do mean by stream? List  all types streams which is supported by java

    2. What is Difference between Character stream and Byte stream

    3. What is bit size required for Unicode, UTF-8 character set

    4. What do you mean object Serialization what is a significant of it? list  out class names which r use to achieve serialization

    5. What do you mean by externalization and internalization what is a significant of it? List out which r use to achieve for same?

    6. Explain a use of BufferedReader , SequenceInputStream PipedInputStream ,PipedOutputStream,File,DataInputStream, DataOutputStream  classes   

    7. What is a transient varialble? How it is related to serialization?

  6. COLLECTIONS AND GENERICS

    1. What do you mean by collection API? List down some classes and interface from collection API?

    2. What is differences between List, Map, Set

    3. What are the differences between HashMap and Hashtable.

    4. What are the differences between Array, ArrayList and LinkedList.

    5. What are the differences between ArrayList and Vector.

    6. What are the differences between Comparable and Comparator  interface?

    7. What are the differences between enumeration ,iterator and list iterator?

    8. What do u mean by 1)ordered unsorted 2) unordered unsorted  3) unordered sorted in collection API

    9. State a difference between LinkedList and ArrayList Class in Collection API

    10. What  does u mean by NavigableSet , NavigableMap interface in collection

    11. State a difference between HashSet and TreeSet Class in Collection API

    12. What does u mean by Generic collection? What is significant of it?

    13. What does u mean by type safety? How to active it

    14. What does u mean by Legacy classes and interfaces?

    15. Explain about GregorianCalendar , BitSet , StringTokenizer, Runtime class, Scanner class

    16. What is the time complexity of a HashSet?

    17. What is the time complexity of a HashMap?

  7. MULTITHREADING

    1. What do u mean by a Thread? 

    2. Explain the difference ways to create threads in java? Explain which one is good and why?

    3. When using the traditional ways to implement a thread (especially before Java 5), which is the method that need to be overriden by a thread class?

    4. What will happen if you start a thread twice using the start() method.

    5. What will happen if you call the run method of a thread directly?

    6. What will happen if you call the run method of a thread twice?

    7. What is difference between wait(), sleep(), yield() methods?

    8. What does u mean by a thread safe class? Give an example.     

    9. Explain ways to achieve thread safety.

    10. What do mean by daemon threads?

    11. What is synchronization? Why do we need synchronization?

    12. Explain the use of volatile modifiers regarding multithreading?   

    13. What is the best way to stop a thread?

    14. What is a dead-lock?

    15. What do you mean by lock-ordering Deadlocks?

    16. [Coding] Can you simlulate a deadlock in Java?

    17. [Coding] Can you simlulate a deadlock in Java using explicit locks?

    18. What are the four necessary conditions for a deadlock to happen?

    19. How can you prevent deadlocks?

    20. [Coding] Can you create producer consumer problem in Java using BlockingQueue?

    21. What is Java concurrency package?

    22. What are Executors and how do you use them?

    23. What is an ExecutorService?

    24. Explain Future and FutureTask

    25. What is a CompletionService in Java concurrency?

    26. What is a Semaphore?

    27. What are latch synchronizers? Explain the working of CountDownLatch.

  8. NETWORKING

    1. What is difference between connected architecture and disconnected architecture explain difference classes are use to achieve them in socket programming

    2. What is use of ServerSocket class , Socket class , DataGramScoket and DataGramPacket class

    3. What is use of  InetAddress class

    4. Give examples for port numbers or range of port numbers that are restricted to use and that may be used. 

  9. JDBC

    1. Explain the working structure of JDBC API 

    2. Explain 4 drivers available is java? 

    3. What is job of drivers? Explain significant of TYPE 4 Driver over all drivers; 

    4. Explain why jdbc API have only few classes and large set of Interface 

    5. What is Difference between Statement , PrepareStatement,  CallableStatement   

    6. What is difference between executeQuery(),executeUpdate(), Execute () methods

  10. ARCHITECTURE

    1. Why event driven mechanism is based on Interfaces?

    2. What do mean by callback method? give any example

    3. What does u mean by Adapter classes? What is a use of these classes

    4. Explain MVC Architecture regarding event driven mechanism   

    5. What do mean by Listeners? List down some listener methods 

    6. What is difference between Swing component and AWT components

    7. What does u mean by a JavaBean class?

  11. GARBAGE COLLECTION AND MEMORY MANAGEMENT

    1. Explain Garbage collection processes of JVM?

    2. Explain the memory structure in JVM

    3. Explain memory structure which get allocated to a class in java

    4. Does java support destructors like some other programming languages? Explain the working structure of GC() and finalize() method? 

  12. MORE JAVA QUESTIONS

    1. Explain Reflection API and use of instanceof keyword?

    2. What is the use of the Cloneable interface? Explain deep cloning/copy and shallow cloning/copy. 

    3. Explain by using how many ways we can able to load a class in to a JVM?

    4. Explain different ways to achieve  security in java

    5. What do you mean by native methods?

    6. How can you convert a String object as a Date object?

 

Please add more questions to this list through the comment section below.

Comments

explain the function system.out.println() ?

Was it useful?

what happens when system.out.println(null) ?

Was it useful?

what are the difference between final and finally finalize() ?

Was it useful?

what is synchronization?why do we need synchronization?

Was it useful?

how to call garbage collector explicitly?

Was it useful?

remove duplicate elements from an array

Was it useful?

difference between array list and vector

Was it useful?

four different ways to create objects in java

Was it useful?

5 different places to define object in java

Was it useful?

WHY java does not support multiple inheritance ?

Was it useful?

difference between enumeration ,iterator and list iterator?

Was it useful?

difference between hashmap and hashtable?

Was it useful?

how to convert string to date in java ?

Was it useful?

what is a transient variable?

Was it useful?

can we instantiate abstract class?

 

Was it useful?

what is vector class?

Was it useful?

is xyz a primitive value?

Was it useful?

when a class should be defined as final ?

Was it useful?

can we apply abstract keyword to interface ?

Was it useful?

can we write empty interface?

Was it useful?

what method must be implemented by all threads?

Was it useful?

can we declare interface as final?

Was it useful?

Quick Notes Finder Tags

Activities (1) advanced java (1) agile (3) App Servers (6) archived notes (2) ArrayLists (1) Arrays (2) Best Practices (12) Best Practices (Design) (3) Best Practices (Java) (7) Best Practices (Java EE) (1) BigData (3) Chars & Encodings (6) coding problems (2) Collections (15) contests (3) Core Java (All) (53) course plan (2) Database (12) Design patterns (8) dev tools (3) downloads (2) eclipse (9) Essentials (1) examples (14) Exception (1) Exceptions (4) Exercise (1) exercises (6) Getting Started (18) Groovy (2) hadoop (4) hibernate (77) hibernate interview questions (6) History (1) Hot book (5) http monitoring (2) Inheritance (4) intellij (1) java 8 notes (4) Java 9 (1) Java Concepts (7) Java Core (8) java ee exercises (1) java ee interview questions (2) Java Elements (16) Java Environment (1) Java Features (4) java interview points (4) java interview questions (4) javajee initiatives (1) javajee thoughts (3) Java Performance (6) Java Programmer 1 (12) Java Programmer 2 (8) Javascript Frameworks (1) Java SE Professional (1) JPA 1 - Module (6) JPA 1 - Modules (1) JSP (1) Legacy Java (1) linked list (3) maven (1) Multithreading (16) NFR (1) No SQL (1) Object Oriented (9) OCPJP (4) OCPWCD (1) OOAD (3) Operators (4) Overloading (2) Overriding (2) Overviews (1) policies (1) programming (1) Quartz Scheduler (1) Quizzes (17) RabbitMQ (1) references (2) resources (1) restful web service (3) Searching (1) security (10) Servlets (8) Servlets and JSP (31) Site Usage Guidelines (1) Sorting (1) source code management (1) spring (4) spring boot (3) Spring Examples (1) Spring Features (1) spring jpa (1) Stack (1) Streams & IO (3) Strings (11) SW Developer Tools (2) testing (1) troubleshooting (1) user interface (1) vxml (8) web services (1) Web Technologies (1) Web Technology Books (1) youtube (1)