Interview Questions and Answers - Order By Newest Q771. Which of the following is not a valid java.util.Locale initialization ? a. new Locale () b. new Locale ( String language ) c. new Locale ( String language , String country ) Core Java
Ans. a i.e new Locale() Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   locale   java.util Q772. Which of the following is not a valid NumberFormat initialization ? a. NumberFormat.getInstance() b. NumberFormat.getDateInstance() c. NumberFormat.getCurrencyInstance() d. NumberFormat.getNumberInstance() Core Java
Ans. b i.e NumberFormat.getDateInstance() Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java.util.numberformat Q773. What will the following code print ? public static void main(String[] args){ Integer i1 = new Integer("1"); Integer i2 = new Integer("2"); Integer i3 = Integer.valueOf("3"); int i4 = i1 + i2 + i3; System.out.println(i4); } Core Java
Ans. 6 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   int   integer   scjp   ocjp Q774. Which of the following syntax are correct ?a. LinkedList<Integer> l=new LinkedList<int>();b. List<Integer> l=new LinkedList<int>();c. LinkedList<Integer> l=new LinkedList<Integer>();d. List<Integer> l = new LinkedList<Integer>(); Core Java
Ans. All are correct. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   generics   linkedlist   list   collections basic Q775. Which of the following code is correct ? a. Date date = DateFormat.newInstance(DateFormat.LONG, Locale.US).parse(str); b. Date date = DateFormat.newInstance(DateFormat.LONG, Locale.US).format(str); c. Date date = DateFormat.getDateInstance(DateFormat.LONG, Locale.US).parse(str); Core Java
Ans. c Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   java.util   date   dateformat Q776. Which methods of the Pattern class have equivalent methods in the String class? Core Java
Ans. split() and macthes() Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   io   string class   string   pattern Q777. Can we compare Integers by using equals() in Java ? Core Java
Ans. Yes for the Wrapper class Integer but not for the primitive int. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   wrapper classes   equalsVery Frequently asked. Favorite question in walkins and telephonic interviews. Usually among first few questions. Asked in different variants. Must know for intermediate and expert professionals.Among Top 10 frequently asked questions. Q778. What is rule regarding overriding equals and hashCode method ? Core Java
Ans. A Class must override the hashCode method if its overriding the equals method. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   hashcode  hash code   equals   collections Asked in 44 Companies intermediate   frequent Try 1 Question(s) Test Q779. What is the difference between Collection and Collections ? Core Java
Ans. Collection is an interface whereas Collections is a utility class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections Asked in 1 Companies Q780. Is Java a statically typed or dynamically typed language ?
Ans. Statically typed Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java Q781. How can we reverse the order in the TreeMap ?
Ans. Using Collections.reverseOrder() Map tree = new TreeMap(Collections.reverseOrder()); Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   map   treemap Try 1 Question(s) Test Q782. TreeMap orders the elements on which field ?
Ans. Keys Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   map   treemap Q783. How TreeMap orders the elements if the Key is a String ?
Ans. As String implements Comparable, It refers to the String compareTo method to identify the order relationship among those elements. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   comparable interface   treemap   compareto Q784. Can we add heterogeneous elements into TreeMap ?
Ans. No, Sorted collections don't allow addition of heterogeneous elements as they are not comparable. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   comparable interface   treemap Q785. Will it create any problem if We add elements with key as user defined object into the TreeMap ?
Ans. It won't create any problem if the objects are comparable i.e we have that class implementing Comparable interface. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   treemap   comparable interface Q786. Can we have null keys in TreeMap ? Core Java
Ans. No, results in exception. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   treemap Asked in 6 Companies Basic   frequent Q787. Can value be null in TreeMap ? Core Java
Ans. Yes. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   treemap   yes-no Q788. Which interface TreeMap implements ?
Ans. TreeMap implements NavigableMap, SortedMap, Serializable and Clonable. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   treemap Q789. Do we have form beans in Struts 2 ?
Ans. No, because they are not longer required. As action classes are no more singleton in Struts 2, user inputs can be captured in action itself. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  struts   struts2   struts 2Frequently asked in Phone Interviews. Q790. What the Bean scopes provided by Spring ? Spring
Ans. Singleton , Prototype , Request , Session , global-session Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  spring framework   bean scope   general electric   geFrequently asked in Phone Interviews. Q791. What are the various Auto Wiring types in Spring ?
Ans. By Name , By Type and Constructor. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   spring   spring container   dependency injection   auto wiring   auto wiring types   general electric   ge Q792. What are the the methods to clear cache in Hibernate ? Hibernate
Ans. Evict() and clear(). Evist is used to clear a particular object from the cache whereas clear clears the complete local cache. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   orm   hibernate cache Q793. What are different types of second level cache ? Hibernate
Ans. 1. EHCache ( Easy Hibernate )
2. OSCache ( Open Symphony )
3. Swarm Cache ( JBoss )
4. Tree Cache ( JBoss ) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   orm   hibernate cache   technical lead Asked in 7 Companies Q794. Can we disable first level cache ? What should one do if we don't want an object to be cached ? Hibernate
Ans. No.We can either call evict after the object retrieval or can use separate sessions. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   orm   hibernate cache   architectureAns. Hibernate is a Java ORM Framework. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   orm   frameworks   architecture Q796. What are the different types of inheritance in Hibernate ? Hibernate
Ans. Table Per Class , Table per Sub Class , Table per Concrete Class Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   orm   inheritance hibernate Asked in 1 Companies Basic   frequent Q797. What is lazy fetching in Hibernate ? Hibernate
Ans. Lazy fetching is the technique of not loading the child objects when parent objects are loaded. By default Hibernate does not load child objects. One can specify whether to load them or not while doing the association. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   lazy fetching   architecture Asked in 11 Companies   frequent Try 2 Question(s) Test Q798. Different types of Hibernate Instance States ? Hibernate
Ans. Transient - In this state, an instance is not associated with any persistence context Persistent - In this state, an instance is associated with a persistence context Detached - This is a state for an instance which was previously associated with a persistence context an has been currently closed dissociated Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate Q799. Is It Good to use Reflection in an application ? Why ? Core Java
Ans. no, It's like challenging the design of application. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   reflection api   yes-no   architecture Asked in 1 Companies intermediate Q800. Why is Reflection slower ?
Ans. Because it has to inspect the metadata in the bytecode instead of just using precompiled addresses and constants. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   reflection   reflection api   architecture