Monday 28 December 2015

Java Interview Questions

    Basic core java Interview Questions And Preparation Guide
      Difference between HashMap and TreeMap with an Example
      Difference between the JRE and the JDK
      JIT Compiler
      How HashMap works in Java
      How to override hashCode method
      How TreeMap works in Java
      Shallow copy and Deep Copy
      Reading and Writing system properties in java
      How LinkedHashMap works in Java
      Statically Vs Dynamically typed Programming languages
      Difference between iterator and enumerator
      Difference between Iterator and ListIterator
      Calculate method execution time
      Examples to concatenate strings in Java
      Java stores in big-endian format
  Comparable Vs Comparator
      How IdentityHashMap Works in Java?
      Serialization
      Difference between HashMap and IdentityHashMap
      How HashTable works in Java
      Why Synchronization is costly operation
      Why get method is synchronized in Hashtable?
      Why Wait and Notify is in Object Class
      Dead lock Example
      Difference between HashMap and Hashtable
      How to traverse HashMap in Java
      Externalization
      Producer Consumer Problem
      How to traverse TreeMap in Java
      Create Memory leak in Java
      Is overriding of static methods possible in Java ?
      Object Creation and Destruction
      Can I access private variables in Java ?
      Is finally always execute in Java ?
      Features Of Java
      Garbage Collection
      Why to declare local variables as final inside methods?
      Sort HashMap by key and value
      Sort List of objects on multiple fields
      char array is proffered over strings to store passwords
      Relation between Method Overriding And Exception Handling
      How to create Immutable class
      How to solve Unsupported major.minor version 51.0?
      Serialization Vs Singleton
      Implement custom iterator in Java
      Provide for-each behavior to custom collection
      Explain different areas of Java Heap
      Is System.exit takes negative value?
      Sort elements of a list in predefined order
      Implement pooling functionality for connection objects
      Why do we require empty collections?
      Why do we require empty iterators?
     Difference between System.out and System.err
    Is Serializable class has any methods?
    How to see the serialVersionUID of serialized class?
    What happen if one of the members in the class doesn't implement Serializable interface?
    Can I apply transient keyword to methods?
    Is serializable class require default constructor while doing serialization and deserialization?
    Is Serialization saves super class fields?
    Can I customize serialization process?
    Restrict a class from serialization, but super class is serialized
    Implement Bijective Map
    How to resolve Circular Dependency Problem
    What is ReentrantLock?
    Non-Blocking Algorithms
    Implement Thread Pool in Java
    Why to use static factory methods over constructors
    When to use builder pattern
    Implement Singleton with Enum
    Can I Extend a class with only private constructors?
    Why to use Boolean.valueOf than Boolean constructor?
    Why should we avoid finalize method?
    Why to implement Comparable?
    Is operations on primitive types are atomic?
    What is null in Java?
    Can I pass null to append method of StringBuilder?
    Why and how to set JAVA_HOME
    Get elements of LinkedHashMap by access order?
    Implement LRU cache using LinkedHashMap
    Implement Array Iterator
    How to get the interfaces implemented by a class?
    Different ways to sort Array list in Java
    Initialize list in one line
    Merge generic arrays
    How to get shallow copy of array?
    Implement case insensitive map
    What is the problem with type erasure?
    Remove element at given index from array
    Redirect System out and error messages to files programmatically
    Implement a stream that writes to multiple streams
    Java is pass by value or pass by reference ?
    Why Generic types in Java are invariant?
    Populate one object from other object properties
     Can I declare an array, collection (or) object as volatile?
    Why should a private constructor throw an exception?
    Can a private constructor prevent sub-classing of class?
    How to bypass checked exception while creating object?
    Is array a primitive type or object in java?
    How to check an exception is checked or not?
    How to check given object is an array or not?
    How to get the system hash code of an object?
    Can a functional interface have more than one method?
    Arrays.asList() throws UnsupportedOperationException while removing element using iterator
    When Can I use ClassName.this
    Is Arrays.asList immutable
    How to create immutable list in Java?
    Open-closed principle design problem
    Threads: print characters of a string simultaneously
    Why an abstract class has a constructor?
    Can I call one constructor from another in java?
    Implement Runnable vs extends Thread
    How to break outer loop in Java?
    null and instanceof operator
    String interning
    Static and Dynamic class loading
    Different ways to dynamically load a class
    Class.forName vs ClassLoader.loadClass
    How the jdbc driver is loaded?
    Can I overload main method of a class?
    Can I throw an exception from static block?
    Does yield method releases the lock?
    Can I call a run method of thread class directly?
    java.util.Date vs java.sql.Date
      Disadvantages of Autoboxing
      How to count number of instances of a class?
      Why a collection doesn’t extend Cloneable or Serializable interfaces?
      Explain about WeakHashMap
      Class Name of anonymous class
      Annotations explained
      Is length property of array final?
      Can I define an array of size 0?
      Can I define an array with negative size?
      Why the interface variables are public, static, final by default?
      Why a non-static method can’t be referenced in static context?
      Get first element from a collection
      How to stop a thread in Java?
      How to pass method as a parameter in Java?
      Shuffle array lists in same fashion (java)
      How to shuffle an array?
      How to specify timeout to a thread?
      Remove elements of map while iterating?
      Default values of primitive fields
      What is the default value of Boolean field?
      Is null instance of anything?
      Iterate list in reverse order
      Can I use calloc and malloc as variable name in Java?
      Check whether a number is 32 bit integer or not
      How to get Original Hash code of the object?
      What is the use of Collections.emptyList in Java?
      Is Collections.emptyList() immutable?
      Is Collections.emptyList() singleton?
      List Capacity vs Size
      ArrayList: add: IndexOutOfBoundsException
      Check two lists contain same elements or not (order not required)
      How to pick random element from Set?
      Why Set do not have get(int index) method?
      Combine hashmaps with same type
      Can a non-void method compiles, run without return value?
      Get currently running threads in Java
      Can a Constructor throw an exception?
      Finalizer Attack in Java
      map vs flatMap
      Convert array of strings to a string
      Explicitly invoke the default implementation of a method
      Regular Expression: Remove all non-numeric characters from string
      Can a constructor in Java is private?
      What is |= stands for in Java?
      What is &= stands for in Java?
      Capitalize first letter of every word in string
      Can an Anonymous class has an explicit constructor?
      How Java handles Integer overflows and underflows?
      Thread.start() vs Runnable.run()
      Pass ArrayList to a method with varargs?
      Can I define synchronized methods in interface?
      How to define global variables in Java?
      Why does (a == (a = b)) not same as (a = b) == a?
      How to copy elements of ArrayList to other list?
      How to check given string represent integer or not?
      equals() vs Arrays.equals
      Convert List to a Map
      Java Bean vs POJO
      How many threads supported by Java?
      How to initialize long in Java?
      How to Initialize Multiple Variables to same value in Java?
      Extract digits from a string or text
      Remove first character of a string
      List: Replace element at specific index
      How to check whether a collection is null or empty?
      How to check whether a map is null or empty?
      Convert String to a character
      Get intersection of two sets
      Transform Map to Map
      How to initialize String array
      Split comma separated string to list of strings
      How to declare ArrayList with values?
      How to initialize string array?
      Implement re-try-catch
      NumberFormatException Explained
      Initial heap size set to a larger value than the maximum heap size
      Is below statement compile?
      Versioning History of Java
      Understanding ConcurrentModificationException in Java
      Java: Remove oldest entry from the map
      Synthetic constructs in Java
      What is bridge method in Java?
      How HashSet behave while adding a duplicate value?
      How to call a method asynchronously in Java?
      How method overloading works with null values in Java?
      Java: How to find maximum element from a collection?
      Java: How to find the minimum element in a collection?
      Java: Get the index of first occurrence of a substring
      Java: Get the index of last occurrence of a substring
      Java: Get all the indexes of occurrence of a substring
      Java: How to replace a value in ArrayList or LinkedList
      Why do we declare logger with static and final?
      Java: Remove single character at given index from a string
      Java: How to access this from Anonymous class?
      How to check the type of a variable in Java?
      Set a system property in command line
      How to get the capacity of ArrayList in Java?
      volatile reference vs Atomic references defined in java.util.concurrent.atomic package
      Check whether I have JDK or JRE in my system
      How to check whether string contain only whitespaces or not?
      How to call base class method from subclass overriding method?
      Can an interface extend multiple interfaces in Java?
      How to specify jar files in command line?
      Explain Loop inversion in Java
      instanceof operator behavior with interface and class
      Call the main method of one class from other class using reflection
      Check whether a class exists in the classpath or not
      How to get the name of calling class that invoke given method?
      Implement map using array as storage
      How to resolve NoClassDefFoundError?
      Jagged arrays in Java
      Get the length of longest row in a two dimensional jagged array in Java
       Quick guide to OutOfMemoryError in Java
      StackOverFlowError vs OutOfMemoryError in Java
      Different ways to iterate over a map using for-each loop
      How for-each or enhanced for loop works in Java?
      How to solve UnsupportedClassVersionError in Java?
      How to find the Java major and minor versions from a .class file?
      Can I run a class file that is compiled in lower environment?
      How to solve Error: Could not find or load main?
      float vs double in Java
      Quick guide to race condition in Java with examples
      How to read the file content using an iterator in Java?
      Implement a Closeable iterator in Java
      Quick guide to generate random data in Java
      What are the different cache eviction strategies?
      How to call super class method from sub class overriding method?
      Can an enum has abstract methods in Java?
      Can enum implement an interface in Java?
      What happen to the threads when main method complete execution
      Why System.out.println() is not throwing NullPointerException on null references?
      Why should we restrict direct access to instance properties?
      Closeable vs AutoCloseable in Java
      What is the behaviour of static final method in Java?
      How to check two double values for equality?
      Why to do explicit type casting from double to float conversion?
      When is a class or interface is initialized or loaded in Java?
      How to check two float values equality?
       How to check whether a class is loaded or not in Java?
      How to get a random element from Set?
      Extract the elements of specific type in a collection
      Method overloading ambiguity with null values in Java
      Quick guide to load balancers
      Constant folding in Java
      Quick guide to assertions in Java
      java.util.Date vs java.sql.Date
      How to break out of nested loops in Java?
      Implementation of Bag data structure in Java
      Scanner throws java.util.NoSuchElementException while reading the input
      How to get all the enum values in Java?
      Extend the thread to check it’s running status
      Implement retry handler for a task in Java
      Design an utility class to capture application metrics summary in Java
      Utility class to get primitive type from wrapper type and vice versa
      FNV hash algorithm implementation in Java
      Controlling Randomness in Java: Exploring the Role of Seeds in java.util.Random
      Program to create append only log file in Java
      Calculating initial capacity from expected size and load factor
      Implement a shared reentrant lock
      A Beginner's Guide to UUID Types
      Ensuring Platform-Independent Accuracy: A Guide to strictfp in Java
      Creating Case-Insensitive Maps in Java: Simplifying Lookups with Lowercase Keys

No comments:

Post a Comment