Interview Questions and Answers - Order By Rating Q701. Difference between Include Directive and include action in jsp Java EE
Ans. Include directive includes the file at translation time (the phase of JSP life cycle where the JSP gets converted into the equivalent servlet) whereas the include action includes the file at runtime. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  JSP  include directive  include action Asked in 1 Companies Q702. Which type of EJB can use bean pooling? Java EE
Ans. Stateless Session Beans Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  EJB  java beans Asked in 1 Companies Q703. If two Interfaces have same Method, how to handle that Method in a Class implementing these two Interfaces? Core Java
Ans. It doesn't matter how you define that method in implementing class. there will be only one definition provided and that method can be accessed using reference of either of the interfaces. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q704. What are the types of Executor Interfaces ? Core Java
Ans. Executor - Simple Interface that supports launching new tasks.
ExecutorService - Subinterface of Executor, which adds features that help manage the lifecycle, both of the individual tasks and of the Executor itself.
ScheduledExecutorService - Subinterface of ExecutorService, supports future and-or periodic execution of tasks. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Executor Interfaces Asked in 1 Companies Q705. how to get most significant bit from a byte? Core Java
This question was recently asked at 'Amazon'.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 Q706. Write a program to reverse words of a sentence. Core Java
This question was recently asked at 'Amazon'.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  code  Coding Asked in 1 Companies Q707. Given array of integers, find first two numbers that adds up to 10. Core Java
This question was recently asked at 'Amazon'.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  Code  Coding Asked in 1 Companies Q708. Can we override an abstract method with abstract method in the derived class ? Core Java
Ans. Yes, but in that case the derived class itself should be abstract. We cannot have an object of a class without definition for the method which has been declared abstract in the parent. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  overriding  overriding abstract methods  abstract methods Q709. Can we override abstract methods ? Core Java
Ans. Abstract methods are the methods that need to be overridden in the derived class ( either as implementing method or again abstract method ) so it's not only allowed but its required to override abstract method in the derived class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  overriding  abstract methods  overriding abstract methods Q710. Can we overload abstract methods ? Core Java
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  overloading  abstract methods  overloading abstract methods Q711. What is the precedence of operators in Java ? Core Java
Ans. http://introcs.cs.princeton.edu/java/11precedence/ Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  operators  operator precedence basic Q712. What is Substitutability in Java ? Core Java
Ans. Substitutability means that the type of the variable does not have to exactly match with the type of the value assigned to that variable. For example - Object reference of Parent object can hold derived object. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q713. How do threads share information ? Core Java
Ans. Through common memory area. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  threads Asked in 1 Companies Q714. write program to do matrix multiplication Core Java
This question was recently asked at 'Kony Labs'.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 Q715. How Marker interfaces works internally ? Core Java
This question was recently asked at 'GGK 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  marker interfaces  interfaces Asked in 1 Companies expert   rare Q716. What are some of the Java Naming conventions ? Core Java
Ans. 1. Class name should be a noun and should start with capital case character.
2. Interface Name should be an adjective and should start with capital case character.
3. Method and Variable names should follow lower camel case notation.
4. package name should be all lower case.
5. constant variables (static final) should be all capital case. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  naming conventions basic Q717. What is an execution engine within JVM ? Core Java
Ans. Execution engine contains interpreter and JIT compiler, which covert byte code into machine code.
Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  jvm  execution engine  compiler Asked in 1 Companies Q718. What access the variable gets if we don't provide any access specifier ? Core Java
Ans. It gets the default access i.e package protected. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  access specifiers  default Access specifier Basic Q719. How are the concept of Association related to Composition and Inheritance ? Core Java
Ans. Composition and Inheritance are the different types of Associations for Classes.
Composition is a has-a association between classes.
Inheritance is a is-a association between classes. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  composition  object oriented programming (oops)  oops concepts  inheritance  object oriented programming (oops)  oops concepts  association  relationship between objects Q720. What are the core OOPs concepts ? Core Java
Ans. Abstraction, Encapsulation, Polymorphism , Composition and Inheritance Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  core oops concepts Asked in 65 Companies basic   frequent Q721. Write a method / program that will determine if the parenthesis are balanced in a given string. Core Java
Ans. https://www.geeksforgeeks.org/check-for-balanced-parentheses-in-an-expression/ Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  string  code  coding Asked in 14 Companies Q722. Why is it important to close files and streams ? Core Java
Ans. Optimizing Resource utilization. When you open a file using any programming language , that is actually a request to operating system to access the file. When such a request is made , resources are allocated by the OS. When you gracefully close those files, those resources are set free.
In Java if you don’t close the streams and files, Garbage collection identifies the open files which have lost the reference and hence will close them. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  file handling Q723. What is the difference between && and & in Java ? Core Java
Ans. && is a Logical whereas & is a bitwise operator Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  operators  logical vs bitwise operator Q724. Why don't Java objects have destructors ? Core Java
Ans. Java manages memory using built-in garbage collector Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  destructor  garbage collection Q725. Write a Java program to print 10 random numbers between 1 to 100? Core Java
This question was recently asked at 'karya 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  coding  code Asked in 1 Companies Q726. Ho do you share / transfer variables between JSP pages ? Java EE
This question was recently asked at 'UC Davis'.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  jsp Asked in 1 Companies Q727. How to find the median number in an array of integers ? Core Java
Ans.
Arrays.sort(numArray);
double median;
if (numArray.length % 2 == 0)
median = ((double)numArray[numArray.length/2] (double)numArray[numArray.length/2 - 1])/2;
else
median = (double) numArray[numArray.length-1/2]; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  coding Asked in 2 Companies Q728. Write a Program to find the missing integer in an array of consecutive numbers? Core Java
This question was recently asked at 'Knight Capital'.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 Q729. Write a Program to validate if a particular character occurs after another in a string Core Java
Ans. public class Class{
public static void main(String[] args){
String str = "xyz123.co@m";
if(str.indexOf('.') < str.indexOf('@')){
System.out.println("Not a Valid Email Address");
}
}
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  string  string.indexOf  coding  code Q730. Write a Program to validate an email address Core Java
Ans. public class Class{
public static void main(String[] args){
String str = "xyz@123.com";
if(!str.contains("@") && !str.contains(".") && (str.indexOf('.') < str.indexOf('@'))){
System.out.println("Not a Valid Email Address");
}
}
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  validate an email address  coding  code Asked in 3 Companies