- New Updates Alerts-Subscribe

Our Telegram Channel - Join Us

Our Free Email Alerts - Join Us

Important Note:Login & Check Your
Email Inbox and Activate Confirmation Link

Our Whatsapp Group - Join Us

Technical Interview Materials PDF-Free Download

Technical Interview Q & A PDF

14) How do you analyze a heap dump?

There are many tools to analyze heap dump in Java e.g. you can use the jhat tool which comes along with JDK. You can also use Eclipse Memory Analyzer to analyze heap dump to find out any memory leak in Java while dealing with OutOfMemoryError in Java 

15) What is the difference between Web Server and Application Server? 

The main difference between Web and Application Server comes from the fact that you cannot run EJB on the Web server like Tomcat or Jetty. The application server like WebLogic and WebSphere provides the runtime environment for EJB and other advanced services required by Java EE or J2EE specification. 

16) What is the difference between Apache httpd and Tomcat?

Though both httpd and Tomcat are products of Apache software foundation, the httpd is more popular and used across the web and not just in Java world. The httpd is a web server which can serve static HTML files and dynamic content using PHP, Perl or Python, while Tomcat is a Servlet container which provides the runtime environment for Servlet and JSP. You can also use both Apache httpd and Tomcat together in Java world. 

17) Can you use Apache and Tomcat together?

Yes, you can use Apache and Tomcat together. There are many Java web application which is fronted by Apache web server to deliver static resources e.g. HTML files, images, configuration files etc. You can then configure Apache to forward the request to Tomcat. 

18) How do you start and stop Tomcat in Linux?

When you install Tomcat in Linux by unzipping the downloaded package, you can see that there is a and file in the tomcat/bin directory. These scripts are used to start and stop Tomcat in Linux. These scripts internally call, the main script to start Tomcat engine. 

19) How do you start and stop Apache in Linux?

The Apache server runs as httpd daemon in Linux and you can either use kill command after finding the PID of httpd process as shown here or you can use the apachectl script as shown below to start and stop Apache web server in Linux 

Starting Apache web server in Linux 

$ apachectl start 

Stopping Apache web server in Linux 

$ apachectl stop 

Restarting Apache web server in Linux 

$ apachectl restart


/sbin/service httpd restart 

You might need root access to do if Apache web server is not running on your application account. 

20) What is JDBC?

The JDBC stands for Java Database connectivity and it provides API to connect a database from Java programs. Different Java vendors e.g. MySQL, Oracle, Microsoft SQL Server, PostgreSQL they implement the API and provides their driver implementation to allow Java to connect to their database. Since almost every enterprise application has a database, JDBC is very important for any real world projects. 

21) What is the difference between JDBC and JNDI?

As I said in the previous answer, the JDBC stands for Java Database Connectivity and provides APIs and guidelines to connect a database from Java, while JNDI stands for Java Naming and Directory Interface and provides a logical structure for retrieving resources e.g. database, messaging queues, enterprise Java beans without knowing their physical place e.g. host or port. You can register a resource with JNDI and then rest of your application component can access them using JNDI name. The database connection pool is the most common resource accessed via JNDI in web servers like Tomcat or WebLogic. 

22) What is database connection pool? (answer)

As it name suggests, it just a pool of database connections. Since creating a new database connection in real-time is an expensive process and can potentially slow down the response time, many application maintains a pool of active database connection. When a request comes in they retrieve a connection from the pool, get the data from the database and then return the connection back to pool so that it can be reused. This way, response time is improved in most of the Java web application. See here to setup a database connection pool in Tomcat using Spring framework. 

23) Your Java application is connected to a Database via a connection pool. Suddenly your database goes down? Is that an issue with your Java application? Do you need to restart your Java application? 

hint: Since your Java application is using a connection pool, it has active connections to database which will get disconnected once DB goes down. If you try to execute a query, you will receive Socket errors. 

24) How do you send web service request from Linux? 

There are some commands available in Linux e.g. curl and wget which allows you to send HTTP commands, which you can use to call and test your web services from Linux. Particular, Curl is used extensively to test RESTful Web Services because it can send POST request, GET request, request with headers and also authenticate using both basic and digest authentication. 

If you are working with REST API, I suggest learning curl, it's very convenient to check if your API is working properly using curl from the command line. You can even write a script to automate those stuff. 

25) What is the difference between HTTP and HTTPS? 

This is one of the common and easy questions. Of course, you know the difference between HTTP and HTTPS right? well, HTTP is insecure but HTTPS is secure, the extra "s" is for security, which means it not only encode and encrypt the message before sending but also verify the identity of the server by using SSL certificates provided by global certificate authorities e.g. GoDaddy, Thawte, VeriSign, Digicert, GeoTrust, and Comodo. See here to learn more how SSL and Certifications work in Java web application. 

26) What is the difference between the GET and POST method? 

Another simple but frequently asked question on Java support interviews. The main difference between the GET and POST is that GET is both idempotent and safe but POST is not. You can fire GET request multiple time and it will give the same result but multiple POST submission should always be avoided. GET is also used to read data from server and POST is used to send data to the server. 

27) What is the difference between Servlet and JSP? 

This is another interesting Java JEE support Interview Question. Even though both Servlet and JSP is used to create dynamic HTML the key difference between them is their purpose. Servlet is meant for Java developers and you write more Java than HTML and that's why it serves as Controller in many popular MVC framework e.g. DispatcherServlet in Spring MVC. 

On the other hand, JSP is designed for HTML developers and it's more HTML than Java and that's why it is used as "view" in MVC frameworks like Spring and Struts. See the link in the answer for more detailed comparison. 

28) What is the difference between Struts and Spring MVC?

This is again a popular and frequently asked question on Java JEE Interviews. Even though both are popular web MVC framework for Java applications, the key difference is that Spring brings dependency injection first and Struts brings it later using Struts 2.0. 

Spring is also a suite of libraries e.g. you get Spring Security to implement security in your application, then there is Spring Boot, Spring Data, Spring Cloud and many more useful libraries under Spring umbrella. 

29) What is the difference between JDBC and Hibernate? 

There are many differences between JDBC and Hibernate but the most important one is that JDBC provides an API to connect to the database and execute the query but Hibernate is an ORM (Object Relational modeling) framework, which means it allows you to work with objects while it takes care of saving and retrieving object from database. 

In short, in JDBC you need to write SQL queries to get and store data from database but in Hibernate you just deal with objects, Hibernate takes care of issuing SQL queries to the database. 

30) What is the difference between Stack memory and heap? Which one is faster? 

These are just two different memory areas used to store different kinds of variables. The stack is local to every thread while heap memory is shared among all threads. Since Stack is closer to thread and usually implemented using CPU registers they are faster than heap memory. The stack is used to store local variables as well method call frames while heap is used to store objects and class metadata. See the detailed answer for more points. 

31) What is the difference between TCP/IP and UDP protocol? 

There are several differences between TCP and UDP protocol but the most important of them is that TCP provides a guarantee of message delivery while UDP doesn't give any guarantee. Because of this guarantee TCP sends more messages than UDP and hence consume more bandwidth and slower than UDP. TCP is also connection oriented protocol while UDP is connectionless. See the detailed answer for more points. 

32) Your Java application is connecting to another Java application (server) running on the remote host and listening on port 17865. Now, you don't have access to that remote host to go and see if the process is running. How do find if the server is up and running? 

hint: you can use the telnet command 

34) The Java application you support connects to a database via a DNS, which automatically switches to the secondary database server when the primary goes down. You find that in the event of a failover, your Java application is not connecting to secondary DB server? How do you troubleshoot this problem? 

hint: check which version your Java application is running. Some JRE caches the DNS e.g. JRE 1.6 

35) What is a deadlock? How do you find if your Java program has a deadlock? 

The deadlock is a condition which can occur between two or multiple threads. In this case, each of the thread waits for each other and cannot progress. In Java, this usually happens when thread 1 holds the lock required by thread 2 and thread 2 holds the lock required by thread 1. If your Java program is hung then it could be a deadlock. You can take a thread dump and find out if any thread is waiting for the lock hold by other and vice-versa. You can also use jConsole tool to find deadlock.

Source: Contents are provided by Technicalsymposium Google Group Members. 
Disclaimer: All the above contents are provided by Google Group members. 
Further, this content is not intended to be used for commercial purpose. is not liable/responsible for any copyright issues. Quick Links & Study Notes PDF- Free Download