Top 33 Java J2ee Technical Support Engineer Interview Questions
Q1. How Do You Check How Much Memory And Cpu Your Java Process Is Consuming?
First, you need to locate the PID of your procedure, which you could locate through the usage of the "ps" command as shown inside the previous question. Once you locate the PID you could use the "pinnacle" command to discover the CPU and reminiscence usage. Alternatively, you can additionally use the prstat command as proven here.
Q2. What Is The Difference Between The Get And Post Method?
Another simple but regularly requested question on Java assist interviews. The foremost distinction between the GET and POST is that GET is each idempotent and secure but POST isn't always. You can hearth GET request multiple time and it's going to deliver the equal result but multiple POST submission have to constantly be avoided. GET is likewise used to study statistics from server and POST is used to send information to the server.
Q3. You Are Supporting A Java Web Application Which Connects To Many Core Java Process And Gets Data From Them To The Distribution To Clients? One Client Complains That The Request For Data Is Taking Too
check the log, take a look at database, check the file device
Q4. What Is The Difference Between Servlet And Jsp?
This is some other thrilling Java JEE help Interview Question. Even even though each Servlet and JSP is used to create dynamic HTML the important thing difference between them is their motive. Servlet is supposed for Java developers and also you write greater Java than HTML and that's why it serves as Controller in lots of famous MVC framework e.G. DispatcherServlet in Spring MVC.
On the opposite hand, JSP is designed for HTML developers and it is greater HTML than Java and that's why it's far used as "view" in MVC frameworks like Spring and Struts. See the hyperlink inside the wer for extra designated contrast.
Q5. 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, Y
check which model your Java application is strolling. Some JRE caches the DNS e.G. JRE 1.6
Q6. What Is Garbage Collector?
The garbage collector is part of Java digital system that is chargeable for reclaiming reminiscence from lifeless items. It's one of the key components and lets in an application developer to attention on application development as opposed to doing memory control. Some of the famous rubbish creditors are a Concurrent Mark-Sweep rubbish collector and G1 rubbish collector nowadays.
Q7. What Is The Difference Between Jvm And Jit?
The JVM stands for Java Virtual system whilst JIT stands for Just in time Compiler. The JIT is a part of JVM and used to convert the Java bytecode into native machine code which runs quicker. There is a few threshold set if a code runs extra than the edge it will become the candidate of simply in time compilation by way of JIT.
Q8. 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 software is the usage of a connection pool, it has lively connections to database on the way to get disconnected as soon as DB is going down. If you try to execute a question, you may obtain Socket errors.
Q9. What Is The Difference Between Jdbc And Hibernate?
There are many variations among JDBC and Hibernate however the most vital one is that JDBC affords an API to hook up with the database and execute the query but Hibernate is an ORM (Object Relational modeling) framework, which me it lets in you to paintings with items while it looks after saving and retrieving object from database.
In short, in JDBC you need to jot down SQL queries to get and keep information from database but in Hibernate you just address gadgets, Hibernate looks after issuing SQL queries to the database.
Q10. What Is The Difference Between 32-bit And sixty four-bit Jvm?
The foremost differences between 32-bit and 64-bit JVM are that later is designed for sixty four-bit running machine e.G. Windows eight or later variations of Linux. From Java developer's attitude, the principle distinction among them comes from heap size. A 64-bit JVM simply has limitless heap memory compared to 4GB of the theoretical limit of 32-bit JVM. If your program desires more memory, better run it on sixty four-bit JVM with big heap area. See right here to analyze extra about 32-bit and sixty four-bit JVM.
Q11. What Is The Difference Between Jvm And Jre?
The JRE stands for Java Runtime Environment and JVM stands for Java Virtual Machine. You install JRE to run Java software e.G. Applet or Core Java application or Web server like Tomcat. The JVM is part of JRE. See here to learn greater differences among JVM and JRE.
Q12. How Do You Find The Java Version Used By Your Application?
You can run the java -model command within the command set off to find out the model of Java used by your utility. If you have a couple of JDK or JRE established then make sure you operate the only which is used by your software.
Q13. What Does -xmx And -xms Parameters Mean?
These are parameters to specify heap size in Java. The -Xms defines the dimensions of the heap while JVM starts up and -Xmx is used to specify the most heap size for Java software i.E. Your heap cannot grow beyond that and JVM will die by using throwing OutOfMemoryError if your heap would not have enough area to create new items. See right here to learn extra approximately heap reminiscence in Java.
Q14. Your Java Application Is Connecting To Another Java Application (server) Running On The Remote Host And Listening On Port 1786
you can use the telnet command.
Q15. What Is Database Connection Pool?
As it name indicates, it only a pool of database connections. Since creating a brand new database connection in actual-time is an high priced method and might potentially sluggish down the reaction time, many software keeps a pool of lively database connection. When a request comes in they retrieve a connection from the pool, get the statistics from the database after which return the relationship lower back to pool so that it can be reused. This way, response time is progressed in maximum of the Java net software. See here to setup a database connection pool in Tomcat the usage of Spring framework.
Q16. How Do You Take A Thread Dump Of A Java Process?
Taking thread sell off is less difficult than taking heap sell off due to the fact you do not need to don't forget device. In Linux, you may simply use the kill command to take the thread sell off e.G.
$ kill -three PID
will print the thread dump within the log file or wherein System.Out is redirected. Similarly, in Windows, you may use Ctrl + Break from the command set off. Alternatively, you could additionally use jConsole and VisualVM to take the thread unload of Java utility in both Windows and Linux. You can also examine Java Performance The Definitive Guide By Scott Oaks to research extra about thread dump and heap dump.
Q17. How Do You Start And Stop Tomcat In Linux?
When you install Tomcat in Linux via unzipping the downloaded bundle, you may see that there is a startup.Sh and shutdown.Sh report within the tomcat/bin directory. These scripts are used to begin and prevent Tomcat in Linux. These scripts internally call Catalina.Sh, the principle script to start Tomcat engine.
Q18. What Is The Difference Between Path And Classpath?
Both are key environment variable used by Java platform, however the key difference among them is that PATH factors to the JDK binaries or local libraries e.G. Java.Exe, at the same time as CLASSPATH factors to Java binaries e.G. JAR files, which contains bytecode. PATH is likewise system level idea impartial of Java but CLASSPATH is only Java idea and utilized by JVM to load classes required by means of Java application you are jogging.
Q19. What Is The Difference Between Struts And Spring Mvc?
This is once more a popular and often asked query on Java JEE Interviews. Even although both are famous web MVC framework for Java programs, the important thing distinction is that Spring brings dependency injection first and Struts brings it later using Struts 2.0.
Spring is also a collection of libraries e.G. You get Spring Security to enforce safety for your utility, then there's Spring Boot, Spring Data, Spring Cloud and plenty of greater beneficial libraries beneath Spring umbrella.
Q20. How Do You Analyze A Heap Dump?
There are many gear to investigate heap sell off in Java e.G. You could use the jhat tool which comes at the side of JDK. You also can use Eclipse Memory Analyzer to investigate heap dump to discover any memory leak in Java whilst dealing with OutOfMemoryError in Java. See Java Performance The Definitive Guide By Scott Oaks to study greater about reading Java Heap dump.
Q21. What Is The Difference Between Web Server And Application Server?
The main distinction between Web and Application Server comes from the fact which you can't run EJB at the Web server like Tomcat or Jetty. The software server like WebLogic and WebSphere offers the runtime environment for EJB and different advanced services required through Java EE or J2EE specification.
Q22. What Is Outofmemoryerror In Java? How Do You Deal With That?
The Java virtual device throws java.Lang.OutOfMemoryError when there isn't sufficient reminiscence to run the utility e.G. No more reminiscence to create new items, no more memory to create new threads and so forth. The maximum not unusual OutOfMemoryError is the java.Lang.OutOfMemoryError: java heap area, which comes while there's no more reminiscence left to create a new object.
Q23. What Is A Deadlock? How Do You Find If Your Java Program Has A Deadlock?
The impasse is a condition that could occur among two or more than one threads. In this situation, each of the thread waits for each other and can't development. In Java, this usually occurs when thread 1 holds the lock required with the aid of thread 2 and thread 2 holds the lock required by using thread @If your Java application is hung then it could be a impasse. You can take a thread sell off and discover if any thread is looking forward to the lock hold through other and vice-versa. You also can use jConsole tool to find deadlock.
Q24. Can You Use Apache And Tomcat Together?
Yes, you can use Apache and Tomcat together. There are many Java internet utility that is fronted by Apache net server to supply static assets e.G. HTML documents, photos, configuration documents etc. You can then configure Apache to forward the request to Tomcat.
Q25. What Is The Difference Between Http And Https?
This is one of the commonplace and smooth questions. Of direction, the difference between HTTP and HTTPS proper? Nicely, HTTP is insecure but HTTPS is at ease, the greater "s" is for protection, which me it now not best encode and encrypt the message earlier than sending but additionally verify the identification of the server via the use of SSL certificate furnished through worldwide certificates government e.G. GoDaddy, Thawte, VeriSign, Digicert, GeoTrust, and Comodo. See here to analyze extra how SSL and Certifications work in Java internet application.
Q26. How Do You Start And Stop Apache On Linux?
The Apache server runs as httpd daemon in Linux and you could either use kill command after locating the PID of httpd manner as proven right here or you may use the apachectl script as proven beneath to start and forestall Apache net server in Linux
Starting Apache net server in Linux
$ apachectl start
Stopping Apache internet server in Linux
$ apachectl prevent
Restarting Apache web server in Linux
$ apachectl restart
or:
/sbin/provider httpd restart
You may want root get admission to to do if Apache net server isn't always jogging in your application account.
Q27. What Is The Difference Between Apache Httpd And Tomcat?
Though both httpd and Tomcat are merchandise of Apache software program basis, the httpd is greater popular and used throughout the internet and not just in Java international. The httpd is a web server that can serve static HTML documents and dynamic content using PHP, Perl or Python, whilst Tomcat is a Servlet field which affords the runtime surroundings for Servlet and JSP. You also can use each Apache httpd and Tomcat collectively in Java world.
Q28. What Is The Difference Between Stack Memory And Heap? Which One Is Faster?
These are just distinct reminiscence areas used to keep exclusive varieties of variables. The stack is nearby to every thread whilst heap memory is shared amongst all threads. Since Stack is towards thread and commonly implemented the use of CPU registers they're faster than heap memory. The stack is used to shop nearby variables as nicely method call frames at the same time as heap is used to keep objects and class metadata. See the distinct wer for more points.
Q29. How Do You Take The Heap Dump Of A Java Process?
There are many approaches to take the heap unload of a Java manner e.G. Tomcat, but maximum not unusual is with the aid of using gear available in JDK e.G. JVisualVM, jCmd, and jmap. Here is the command you may use to take the heap dump of Java technique:
$ jmap -sell off:stay, record=/region/of/heap_dump.Hprof PID
The heap dump will contain all stay gadgets and they're saved in heap_dump.Hprof file. Remember, you furthermore may need PID of Java technique which you could find through using "ps" and "grep" command as mentioned within the first query. You can see Java Performance Companion by Charlie Hunt to study more approximately taking and analyzing heap dump in Java to discover reminiscence leak and other reminiscence associated errors.
Q30. What Is The Race Condition?
The race condition is another multithreading and concurrency trojan horse which happens due to racing among threads, as an instance, if one thread is updating a variable and 2d thread tries to read the fee before it finished. You can keep away from race situations by nicely synchronizing your code.
Q31. What Is The Difference Between Jdbc And Jndi?
As I stated in the preceding wer, the JDBC stands for Java Database Connectivity and presents APIs and recommendations to attach a database from Java, at the same time as JNDI stands for Java Naming and Directory Interface and provides a logical shape for retrieving resources e.G. Database, messaging queues, company Java be with out understanding their bodily place e.G. Host or port. You can sign up a useful resource with JNDI and then rest of your software element can get entry to them the usage of JNDI call. The database connection pool is the most common useful resource accessed thru JNDI in internet servers like Tomcat or WebLogic.
Q32. How Do You Check Your Java Process Is Running On Linux?
You can test by the use of "playstation " command and "grep" command e.G. Ps grep "myprocess". The keyword which you use with grep for seek may be anything specific in your procedure, some thing which seems in its command line e.G. Name of the elegance which implements the primary technique. You also can do "playstation grep java" to list all Java procedure.
Q33. How Do You Send Web Service Request From Linux?
There are a few commands available in Linux e.G. Curl and wget which permits you to ship HTTP instructions, which you could use to name and check your internet services from Linux. Particular, Curl is used substantially to check RESTful Web Services due to the fact it may ship POST request, GET request, request with headers and additionally authenticate using each primary and digest authentication.
If you are running with REST API, I advise learning curl, it's very convenient to check if your API is running nicely using curl from the command line. You can even write a script to automate those stuff.

