YouTube Icon

Interview Questions.

Birlasoft Java Placement Papers - Birlasoft Java Interview Questions and Answers - Jul 28, 2022

fluid

Birlasoft Java Placement Papers - Birlasoft Java Interview Questions and Answers

Q1. When Abstract Methods Are Used?

If you need a category to include a particular method but you need the actual implementation of that approach to be decided with the aid of toddler training, you could claim the technique in the parent class as abstract.

Q2. What Is Marker Interface? How Is It Used In Java?

Marker interface is an interface which help us to inform few data to JVM/Compiler. The marker interface does no longer have any frame, it’s a empty interface. Ex. Cloneable, Serialization, and many others.

Q3. What Do You Mean By Platform Independence?

Platform independence me that we are able to write and compile the java code in one platform (eg Windows) and may execute the class in some other supported platform eg (Linux,Solaris,and many others).

Q4. Difference Between Final, Finally And Finalize ?

Final is used to apply restrictions on elegance, technique and variable. Final magnificence can’t be inherited, final approach can’t be overridden and very last variable fee can’t be modified.

Finally is used to vicinity important code, it is going to be accomplished whether exception is dealt with or now not.

Finalize is used to carry out easy up processing just before object is rubbish collected. Finalize is used to perform smooth up processing simply before item is garbage amassed.

Q5. What Is The Difference Between An Interface And An Abstract Class ?

An summary magnificence can have instance techniques that put in force a default conduct. An Interface can most effective declare constants and example techniques, however cannot put in force default behavior and all strategies are implicitly abstract. An interface has all public individuals and no implementation.

Q6. What Is The Difference Between Creating String As New() And Literal?

When we create string with new() Operator, it’s created in heap and now not brought into string pool while String created the use of literal are created in String pool itself which exists in PermGen region of heap.

String s = new String(“Test”);

does now not  placed the object in String pool , we want to name String.Intern() technique that is used to position  them into String pool explicitly. Its simplest while you create String object as String literal e.G. String s = “Test” Java robotically put that into String pool.

Q7. How Can A Servlet Refresh Automatically If Some New Data Has Entered The Database?

Basically it relies upon on the state of affairs , how you may cope with. You want  take care of this in dao layer, when doing insert operation you could call an software approach which will load the context ServletContextListener. Because, servlets are basically used for coping with request and give the response.

Q8. What Is An Ejb Context?

The EJBContext interface presents an example with get right of entry to to the field-furnished runtime context of an employer bean example.

Q9. How To Improve Servlet Performance ?

You want to do few tuning for this success. Few points beneath:                                                           

  Use init() approach for all costly operation all through  initialization (can be static records or cached facts ).   

  Always keep away from auto loading of servlet.

  Avoid SingleThreadModel.

  Use and manipulate HttpSession properly.

Q10. What Is The Importance Of Init() Method In Servlet?

Init() approach is one of the life cycle technique of servlet. This method runs once in overall existence. After servlet example created and before it handles request the init() technique will paintings. Its essentially used for initializing values at the time of application startup.

Q11. What Is The Difference Between An Interface And An Abstract Class?

Both are seems similar. But, the basic distinction is abstract class can include summary and non abstract techniques, in which interface only carries summary method (with out technique frame). You can claim fields that aren't static and very last, and outline public, blanketed, and private concrete strategies in summary class. But, in Interface all participants are public, static and final , all strategies are public.

Q12. What Are Wrapper Classes?

These are classes that allow primitive sorts to be accessed as objects. Example: Integer, Character, Double, Boolean and so forth.

Q13. Can You Give Few Examples Of Final Classes Defined In Java Api?

String, Integer ,Float ,and so on. Basically all wrapper classed are very last.

Q14. What Is The Purpose Of Garbage Collection In Java, And When Is It Used?

Garbage collection is a special function in java language. It facilitates developer to save time and further mental tension for managing object allocation in reminiscence. It mechanically clean the unused item from reminiscence which facilitates to allocate space at runtime. When there may be no connection with an object found, it's going to easy that item from memory . You can run the rubbish series explicitly with the aid of using System.Gc().

Q15. What Is The Use Of The Finally Block? Is Finally Block In Java Guaranteed To Be Called? When Finally Block Is Not Called?

Finally is the block of code that executes usually. The code in finally block will execute even though an exception is came about. Finally block is NOT called in following situations

If the JVM exits at the same time as the try or trap code is being done, then the ultimately block won't execute. This can also show up due to System.Exit() call.

If the thread executing the attempt or catch code is interrupted or killed, the eventually block won't execute even though the utility as a whole maintains.

If a exception is thrown in finally block and not handled then remaining code in finally block won't be achieved.

Q16. What Is A Pointer And Does Java Support Pointers?

Pointer is a reference take care of to a memory region. Improper dealing with of tips results in reminiscence leaks and reliability troubles hence Java doesn’t aid the use of suggestions.

Q17. What Is The Main Difference Between Java Platform And Other Platforms?

The Java platform differs from maximum other platforms in the sense that it’s a software-based totally platform that runs on pinnacle of different hardware-based totally systems.

It has two additives:

Runtime Environment

API(Application Programming Interface)

Q18. Is Java Pass By Reference Or Pass By Value?

Its continually bypass by price .

Q19. How Does Jsp Handle Run-time Exceptions?

You can use isErrorPage=”actual” in web page characteristic




CFG