/Java-Interview-Questions

A list of technical questions I've gathered to test knowledge of Java and Android

MIT LicenseMIT

Java Technical Interview Questions

Java

  • What is the JVM?
  • Define code compilation?
  • What is a constuctor?
  • What is the naming convention of variables in java?
  • What is an annotation and give an example.
  • What is the difference betwee '==' and equals() when comparing Strings?
  • What are the 8 primitive types in Java?
  • What is the difference between primitives and wrapper classes and when can we use each?
  • Define Encapsulation and outline its benefits.
  • What is the naming convention for JUnit test methods?
  • When we compile our code, where do the compiled .class files live?
  • Why is Behavior-Driven Development beneficial?
  • What is the difference between an Array and an ArrayList? When do you use one over the other?
  • What is a stacktrace? What does it do for us?
  • Why is it best practice to declare attributes of a custom class private?
  • When would we use char? What is its corresponding wrapper class?
  • Do objects get passed by reference or value in Java? Elaborate on that.
  • Explain the four OOP principles.
  • What is the difference between Abstract classes and Interfaces?
  • Is it possible to implement multiple inheritance in Java?
  • What is serialization? How do you implement it?
  • What are anonymous classes?
  • What does it means to say that a String is immutable?
  • What is the difference between method overloading and method overriding?
  • What are the access modifiers you know? What does each one do?
  • Do objects get passed by reference or value in Java? Elaborate on that.
  • What the difference between local, instance and class variables?
  • What is Dependency Injection?
  • What does the static word mean in Java? Can a static method be overridden in Java?
  • When is a static block run?
  • What is reflection?
  • How does the try{} catch{} finally{}
  • What is garbage collection? How does it work?
  • What is memory leak and how does Java handle it?
  • What does the keyword synchronized mean?
  • Explain Generics in Java

Web Development

  • What is the difference between a GET and POST request?
  • What is a URI?
  • Differenciate between a client and host.
  • What is the difference between HTTP and HTTPS?
  • Point out these components(query, host, port, protocol, path ) in the following URL https://127.0.0.1:4200/login/a=bx?c
  • What is an Internet Protocol?

Android

  • What are the four main components of an Android Application?
  • What is the purpose of a package name?
  • What is the purpose of Android Virtual Device?