Recent Asked Oracle Java Interview Questions with Answers

Java Interview Questions and Answers asked in Oracle India Pvt Ltd


Company Name :  Oracle

Sent By:  Naresh Kumar

Interview Questions: 

1. What are differences b/w concrete,abstract classes and interface & they are given?                                                                              
Concrete class:   A class of  only Concrete methods is called Concrete Class. For this, object instantiation is possible directly. A class can extends one class and implements many interfaces.
                   Abstract class:
                          Interface:
    *A class of only Concrete or only Abstract or both.

    *Any java class can extend only one abstract class.

    *It won’t force the programmer to implement/override all its methods.

    *It takes less execution time than interface.

    *   It allows constructor.

    This class can’t be instantiated directly.
                          
     A class must be abstract when it consist at least one abstract method.
                         
    It gives less scope than an Interface.

    It allows both variable & constants declaration.


    It allows methods definitions or declarations whenever we want.

    It gives reusability hence it can’t be declared as “final”.

     only abstract methods.
                    

    A class can implements any no. of  interfaces
    (this gives multiple interface inheritance )

    It forces the programmer to implement all its methods

    Interface takes more execution time due to its complex hierarchy.
    *   It won’t allow any constructor.

    It can’t be instantiated but it can refer to its subclass objects.
    It gives more scope than an abstract class.
                    
    By default, methods  are public  abstract   variables are public static final.

                   
    It allows  methods declarations whenever we want . But it involves complexity.
                  
    Since they give reusability hence they must not be declared as “final”.

     
2) Can you create a userdefined immutable class like String?
 Yes, by making the class as final and its data members as private, final.

3) Name some struts supplied tags?

  • struts_html.tld
  • struts_bean.tld
  • struts_logic.tld
  • struts_nested.tld
  • struts_template.tld
  • struts_tiles.tld.
 4) How to retieve the objects from an ArrayList?
 

 List list=new ArrayList();        
 list.add(“element1”);                 

 list.add(“element2”);
 list.add(“element3”);          

 Iterator iterator=list.iterator();    
 while(iterator.hasNext()){
  String str=(String)itr.next();       
  s.o.p(string);           
  } 

List<String> list=new ArrayList<String>();  
 list.add(“element1”);                 
 list.add(“element2”);
 list.add(“element3”); 

for(String str:list) {  
s.o.p(str);

                                   
5)  What are versions of your current project technologies?
Java 5.0; Servlets 2.4, Jsp 2.0; struts 1.3.4 ; spring 2.0; Hibernate 3.2, Oracle 9i. weblogic 8.5.
 

6) What is “Quality”?
 It is a Measure of excellence.state of being free from defects, deficiencies, and significant  variations.
 A product or service that bears its ability to satisfy stated or implied needs."
 

7) Can I take a class as “private”?
Yes, but it is declare to inner class, not to outer class.If we are declaring "private" to outer class nothing can be accessed from that outer class to inner class.
 

8)  How can you clone an object?
 A a1=new ();
 B  a11=a1.clone();
 

9) What methods are there in Cloneable interface?
Since Cloneable is a Marker/Tag interface, no methods present.When a class implements this interface that class obtains some special behavior and that will be realized by the JVM.
 

10)  What is the struts latest version?
Struts 2.0
 

11) How are you using “Statement” like interface methods even without knowing their implementations classes in JDBC?

12) Which JSP methods can be overridden?
jspInit() & jspDestroy().
 

13) Explain the JSP life-cycle methods?
  • Page translation: The page is parsed & a Java file containing the corresponding servlet is created
  • Page compilation:   The Java file is compiled.
  • Load class: The compiled class is loaded.
  • Create instance: An instance of the servlet is created.
  • Call jspInit():This method is called before any other ethod to allow initialization.
  • Call _jspService():This method is called for each request. (can’t be overridden)
  • Call jspDestroy(): The container calls this when it decides take the instance out of service.It is the last method called n the servlet instance.    
Kindly Send your attended interview Questions and Answers to faqs@javastuff.com

Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email