Interviews FAQ 1

Here I'm not going to explain the detailed overview of questions, it is just the main points of FAQs that can be asked and this is part one.

What are the features of Java?

  • It is simple (Easy learning curve)
  • Robust (both compile-time/runtime error checking, Memory is managed by itself using Garbage collector)
  • Platform independent
  • High performance (With JVM)
  • Very secure (Java files to class files)

What is a class?

  • Class is a blueprint of which object is created.
  • We can represent a real world object using a class.

What is an interface?

  • The interface is a blueprint of a class.
  • Interfaces allow a class to behave like multiple types.

Why do we need interfaces?

  • Interfaces are mainly used for data abstraction.
  • We can achieve multiple inheritance using interfaces.

What is a Java Bean?

  • Java bean is a class that follows some conventions. 
  • It has a no-arg constructor
  • It is serializable.
  • Its fields can only be accessed by getters and setters
  • Its instance variables are final.

What is a hashcode?

  • Every object has a hashcode, it is  an unique number.
  • This is assigned by JVM.
  • Hash related data structures use this. (HashMap, HashList...etc)

What is called Serialization?

  • This is the process of converting an object into a series of bytes.
  • This is very useful when transferring data, store them in sessions...etc

What is called the string pool?

  • It is a separate area of Heap which consists of String objects.
  • This is maintained by the JVM.

Difference between == vs equals(

  • == are used to compare reference and address.
  • equals() method is used to content comparison. 

Web server vs Application server

  • The application server is the super one.
  • Each application server contains a web server.
  • If you are not satisfied with the inbuilt server, you can add another server.

Web serverApplication server
Ex: Tomcat, Jetty, ResinEx: Glassfish, Wildfly, JBoss, WebSphere
Not J2EE compatibleJ2EE compatible
Can run web applications onlyCan be run both web and enterprise applications
Support for HTML, JSP, Servlets...Support for HTML, JSP, Servlets, EJB, JMS...etc

What is the garbage collector?

  • The garbage collector is a part of the JVM.
  • This is used to manage memory.
  • It runs on its own thread with own algorithm.
  • This will destroy useless data(objects without reference) from memory.

StringBuffer vs StringBuilder

Introduced in Java 1.0Introduced in Java 1.5
Every method is synchronizedNo method is synchronized
At a time only one thread is allowed to operate.Multiple threads are allowed to operate
Thread-safeNot thread-safe
Slow performances Fast performances 

What is toString() method?

  • This is called when we are trying to print object reference.
  • In the collection framework, StringBuffer, StringBuilder, String class already overrides the toSting() method. 
  • If we didn't override toString() method, the object's class toString() method will be called.

Explain the uses of "final" keyword

  • This can be applied to classes, methods, and variables.
  • Final classes cannot be extended.
  • Final methods cannot be overridden.
  • Final variables cannot be changed, they are just constants. 

What is called "ACID" in databases?

  • A - Atomicity
  • C - Consistency 
  • I  - Isolation
  • D - Durability

To be continued...

Interviews FAQ 1 Interviews FAQ 1 Reviewed by Ravi Yasas on 10:54 AM Rating: 5

No comments:

Powered by Blogger.