Interview Questions and Answers - Order By Newest Q1351. What kind of thread is garbage collection thread ? Core Java
Ans. Daemon thread Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  garbage collection intermediate Try 2 Question(s) Test Q1352. What is the difference between the Reader/Writer java.io hierarchy and the Stream class hierarchy? Core Java
Ans. The Reader/Writer hierarchy is character oriented, whereas the Stream class hierarchy is byte oriented. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java io  streams intermediate Ans. It's an object that reads from one stream and writes to another. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java io  io filter intermediate Q1354. Can we convert a numeric IP address to a web host name ? Java EE
Ans. Yes, using InetAddress.getByName("<IP Address>").getHostName(); Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  ip address to hostname  INETAddress intermediate Q1355. Difference between shallow copy and object cloning ? Core Java
Ans. Shallow copy is one of the way for object cloning, other being deep copy. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  cloning  shallow copy  object cloning basic Ans. Shutdown hook is a thread that is invoked before the JVM is shut down. we can use it perform resource cleaning task. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  shutdown hook  jvm Try 1 Question(s) Test Q1357. Which interface is responsible for transaction management in JDBC ? Database
Ans. Connection Interface Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  jdbc Q1358. how to access the methods of an inner class? Core Java
Ans. It depends on the type of inner class
To access non static inner class method
new OuterClass().new InnerClass().getMethod();
To access static method of static inner class
new OuterClass.InnerClass().getMethod(); Sample Code for inner class Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  inner classes  nested aclasses Asked in 1 Companies Intermediate   frequent Q1359. Which memory segment holds String Pool in Java ? Core Java
Ans. String Pool resides in runtime constant Pool which is a part of Heap memory segment. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  string pool  memory management Expert   rare Q1360. What are the cursors available in Java ? Core Java
Ans. Enumeration
Iterator
List iterator Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  cursors  iterator Q1361. Which Web and Application server is being used by your application ? Server
Ans. We are using Apache 2.3 and Tomcat 5.6 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  web server  application server  server Basic   frequent Q1362. How do you monitor the server resources if inadvertently high traffic is reported ? Support
Ans. We use SAR command for that purpose. We also have GUI system monitoring tool to keep real time check of requests, load and memory usage. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  production support  unix  SAR Q1363. How do you monitor your logs while investigating a high severity problem ? Support
Ans. We try to look for errors in the last n minutes when the issue occurred. If the issue is still occurring intermittently, We tail the logs for different application server instances to see the error snippets coming in the live logs. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  production support  unix  application logs Q1364. What all caching has been used in your application? Support
Ans. We are using Akamai as web server cache. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  caching  production support Q1365. Have you ever faced any problem due to caching? Support
Ans. Yes , sometime we receive issues related to outdated pages being rendered to the user. In those cases we clear the cache and then try to investigate the reason for that. Sometime the issue is due to comparatively high refresh interval. In those cases we reduce the cache refresh interval. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  production support  caching Q1366. What actions you take if there is an issue related to Database server ? Support
Ans. We involve DBA and try to solve it through them. By the time they are solving it , we keep the stake holders informed regarding the progress. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  database  database server  production support Q1367. Do you use command aliases while doing your work ? General
Ans. Yes , I have created many aliases and saved them within my .profile file so that the system loads them, the each time i logs onto the server. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  unix  command aliasis Q1368. How are DB transactions handled in Hibernate ? Hibernate
Ans. // Non-managed environment idiom
Session sess = factory.openSession();
Transaction tx = null;
try {
tx = sess.beginTransaction();
// do some work
...
tx.commit();
}
catch (RuntimeException e) {
if (tx != null) tx.rollback();
throw e; // or display error message
}
finally {
sess.close();
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1369. How to use Find command in Unix ? Unix
Ans. http://javasearch.buggybread.com/UnixCommand/searchUnixCommandsScripts.php?keyword=find Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  find command Asked in 1 Companies Q1370. How can be restrict creation of more than n objects in Java ? Core Java
Ans. We can follow the same design which we follow in singleton Classes. We can have a static counter that will keep the count of number of objects already created, We can keep the constructor private and being called through the static method. We can keep incrementing the counter before calling the constructor and put a check to call only if it's lesser than n. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1371. Do you feel that its useless to define hashCode method for a class ? Core Java
Ans. Yes its useless if we are not going to use its objects within Hash collection, For example - HashSet , HashMap. HashCode is used internally by these collections for Search. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hashcode  hash collections  search Q1372. What is the difference between filter and filter-mappings xml tag within deployment descriptor ? Java EE
Ans. filter tag speficies the filter name and respective class for handling filter action whereas filter mapping maps the filter to the url patterns ( specifying the url that needs to be intercepted ) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  deployment descriptor  web.xml  filters  filter mapping Q1373. Have you heard of SiteMesh ? Java EE
Ans. Sitemesh is a web page layout and decoration framework by OpenSymphony. SiteMeshFilter can intercept the requests and then build UI components (based on configuration) then renders the final page. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sitemesh Q1374. What is a class and object ?
or
How would you explain a fresher the concept of class and object in simple terms ? Core Java
Ans. Class is a template using which objects are created in memory. It's kind of a mold using which objects with body / state are made.
Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  class  object  class vs object Asked in 4 Companies basic   frequent Ans. Its used to access the object properties using the object reference or class properties using the Class Name. Moreover its used to access the classes and Interfaces of a package. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  operators Q1376. How should we handle errors while writing or accessing Stored Procedures? Database
Ans. Store Procedure returns the error code. Moreover we can put the call withing try block and catch SQL Exception. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  stored procedure  exception handling Q1377. Does Java supports Default arguments ? Core Java
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1378. Can we have only try block in java ? Core Java
Ans. No, It should be followed by either catch or finally. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  try  exception handling Q1379. What is memory leak ? How Java helps countering memory leaks compared to C++ ? Core Java
Ans. Memory Leak is a situation wherein we have a reserved memory location but the program has lost its reference and hence has no way to access it.
Java doesn't have concept of Pointers, Moreover Java has concept of Garbage collection that frees up space in heap that has lost its references. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  memory leak  garbage collection intermediate   frequent Q1380. Write an algorithm / java program for Heap Sort ? Algorithm
Ans. https://www.geeksforgeeks.org/heap-sort/ Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sorting  heap sort Asked in 1 Companies   frequent