Interview Questions and Answers - Order By Newest Q2351. Why Hadoop serialized data types are not using in Spark serialization ? BigData
This question was recently asked at 'Tavant Technology'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2352. Explain CloneNotSupportedException ? Core Java
Ans. If we do not mention, Cloneable Interface to the Class which we want to Clone then we get this exception, only if we try to clone an object
Like:
public class TestClone{
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
}
In Main, You try to do:
TestClone clone = new TestClone();
TestClone clone2 = (TestClone) clone.clone();
You will get CloneNotSupportedException.
Just add -> public class TestClone implements Cloneable {
and things are fixed. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  exceptions handling  cloning Q2353. Does abstract class have public constructor? Core Java
Ans. Yes, an abstract class can have a constructor in Java. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  abstract class  public constructor Asked in 1 Companies Q2354. What measures would you take to avoid Java threading issues in a multi-threaded environment ?
This question was recently asked at 'Fifth Third Bank'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  aws param store  amazon param store  aws lambda  amazon lambdaAns. No HashMap isn't synchronized. ConcurrentHashMap and Hashtable are synchronized. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hashmap  synchronization Q2357. Is ConcurrentHashMap synchronized ? Core Java
Ans. Yes, ConcurrentHashMap is synchronized. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  ConcurrentHashMap Q2358. Difference between equals and compareTo in Java ? Core Java
Ans. "equals" is the method of object class which is supposed to be overridden to check object equality. x.equals(y) means the references x and y are holding objects that are equal.
The compareTo() method is used for comparing two objects in Java. It is usually defined for the classes whose objects needs to be ordered through Comparable interface or need to be part of an ordered collection like TreeSet or TreeMap. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  equals  compareTo  equals vs compareTo Q2359. Why is String a class in Java ? Core Java
Ans. 1. Creating a class helps in specifying operations on the Strings like length , sub string , concatenation etc.
2. It acts as a Wrapper class for "Array of Characters" and hence facilitates it's usage in collections, assignment to null.
3. Immutability of String objects facilitates in reuse , security and caching. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  string class Q2360. What is the difference between Encapsulation and encryption ? Networking
Ans. Encapsulation is the process of wrapping the data with another layer to be transported across the network with the source and destination details on just like the analogy of wrapping letter in envelope with the source and destination details on the envelope. Encryption on the other hand is the process of hashing text or transforming the data in a form that is not readable except you have access to the key use to decrypt it. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2361. What is the difference between final and static in java ? Core Java
Ans. final keyword is used to restrict the user from modifying the variable, extending the class and overriding a method
static keyword is used for memory management which can be used for variable, class, method where in it belongs to the class not to the instance of object Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 2 Companies Q2362. difference between ArrayList and array ? Core Java
Ans. ArrayList is a variable length collection class whereas arrays are fixed length primitive structure.
We can use generics with arraylist but not with arrays.
We can store primitive data types within arrays but can't with ArrayList. In ArrayList that needs to be converted to Wrapper objects.
Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  arraylist  arrays  collection classes  collections basic   frequent Q2363. Difference between ArrayList and HashSet ? Core Java
Ans. ArrayList is a list , i.e an implementation of List interface whereas HashSet is a Set and an implementation of Set interface. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  arraylist  hashset Q2364. Difference between TreeMap and SortedMap ? Core Java
Ans. sortedMap is an interface ,while TreeMap is an implementation of sortMap.
We can not create an instance of sortedMap but we can create an instance of treeMap Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  treemap  sortedmap Q2365. Difference between HashMap and Dictionary in Java ? Core Java
Ans. HashMap implements the Map interface while the Dictionary does not.
HashMap was introduced after HashTable and Dictionary.
Dictionary is currently obsolete in java. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hashmap  dictionary class Q2366. Difference between System.getEnv and System.getProperties ? Core Java
Ans. System.getEnv gets the environment variables where System.getProperties gets Java properties. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  System.getEnv  System.getProperties  environment variables Q2367. Can we load environment variables into Properties in Java ? How ? Core Java
Ans. Yes
new Properties().putAll(System.getenv()); Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java.util.properties  environment variables Q2368. If you are asked to test an application without any documentation, What type of testing will you do ? Testing
Ans. White Box Testing
Unit Testing
Ad Hoc Testing Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2369. Sort an Employee Object based on Name or Age Database
Ans. Use Comparable or Comparator interface Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sql query Asked in 1 Companies Q2370. What is cluster ?
This question was recently asked at 'idealake information technologies'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2371. What is the concept of hibernate versioning ? Hibernate
This question was recently asked at 'Tata Consultancy (TCS)'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate versioning Asked in 1 Companies Q2372. If we have a return statement inside the finally block, Then what will happen ? Core Java
Ans. Returning from inside a finally block will cause exceptions to be lost. A return statement inside a finally block will cause any exception that might be thrown in the try block to be discarded. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  exception handling  finally block Asked in 1 Companies Q2373. Can we have more than two constructors in a class ? Core Java
Ans. Yes, through constructor overloading Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  constructor overloading Q2374. What is something faulty about java ? Core Java
Ans. Not purely object oriented Language. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   expert Q2375. What are the distributed caches ? Server
This question was recently asked at 'RiseSmart India'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  caching  server  production support Asked in 1 Companies Q2376. Create DB schema for Employee, Department. Database
This question was recently asked at 'RiseSmart India,RiseSmart'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  db schema  database schema  database design Asked in 2 Companies Q2377. Differences between MongoDB and mysql. Database
This question was recently asked at 'RiseSmart'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2378. How do you debug Javascript code ? Javascript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2379. Where will you configure database details in tomcat server ? Tomcat
Ans. Add a file META-INF/context.xml into the root of your web application folder, which defines database connection detail :
File : META-INF/context.xml Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2380. What are the 22 possible values of x where x== -x (true) ? Core Java
Ans. byte x = 0;
short x = 0;
char x = 0;
int x = 0;
int x = Integer.MIN_VALUE;
float x = 0.0f;
float x = -0.0f;
long x = 0;
long x = Long.MIN_VALUE;
double x = 0.0;
double x = -0.0;
Byte x = 0;
Short x = 0;
Character x = 0;
Integer x = 0;
Integer x = Integer.MIN_VALUE;
Float x = 0.0f;
Float x = -0.0f;
Long x = 0L;
Long x = Long.MIN_VALUE;
Double x = 0.0;
Double x = -0.0; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies