Oracle pre interview basic java question for experience

 






Technical questions: Oracle pre-interview 

 

1. What are immutable objects? name few steps to create it

2. What are the advantages of ArrayList over arrays?

3. How does thread communicate with each other?

4. Can you tell some of the software design patterns that you have used or know about

5. Mention which pattern is used when we need to decouple an abstraction from its implementation

6. What are the different Spring Boot Components?

7. How to obtain an Array from an ArrayList?


1. Immutable objects are objects whose value can’t be changed once initialized. 

These are the steps to how we create immutable objects.


a) Declare the class as final. This will protect the class from extending. 

b) All fields should be private. So that direct access can’t possible.

c) All fields should be final. 

d) There must not setter method. 



2. ArrayList is a resizable class of  Collections. Arraylist implements List interface.

There are many methods which useful for Arraylist data processing. We also 

define the initial size of an ArrayList. 

Array is a set of data with fix initial size. Array iteration, removal, and other 

 Operation methods are not available for array. It throws a Memory Outbound exception if elements are more than its size.

3. Thread uses   wait() , notify() , notifyAll()  for thread communication . 

4. There are three design patterns we have 

a) Creational, -Factory Design pattern, Singleton, Prototype, Builder 

b) Behavioral –Command, Iterator, Observer 

c) Structural –Adaptor, Composite, Decorator

5. Bridge design pattern -  BDP decouples the abstraction from its implementation so that it can vary independently.

6. Springboot components are 

a) Springboot  starter  

b) Springboot   autoconfiguration 

c) Springboot CLI 

d) Springboot Actuator 

      

         7)    This is how we can change  Arrarylist  in Array 


                  ArrayList<String> list = new ArrayList<>();

         

                   list.add("A");

        list.add("B");

        list.add("C");

        list.add("D");

         

        //Convert to string array

        String[] array = list.toArray(new String[list.size()]);

         

        System.out.println(Arrays.toString(array));





    







Oracle pre interview basic java question for experience Oracle pre interview basic java  question for experience Reviewed by Mukesh Jha on 4:16 AM Rating: 5

No comments:

Add your comment

All Right Reserved To Mukesh Jha.. Theme images by Jason Morrow. Powered by Blogger.