Languages-Java [3i Infotech Placement]: Sample Questions 100 - 101 of 141

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 100

Edit

Describe in Detail

Essay▾

What is the use of an interface?

Explanation

  • Interface defines a set of functionality- a rule or a contract.
  • One cannot define any method inside an interface declaration.
  • When a class implements an interface all the functionality must be implemented in the concrete class.
  • Useful for building a larger system or a library, which keeps evolving.
  • An interface in java allows multiple inheritance.
  • Interfaces are flexible, because a class can implement multi interfaces.
  • Abstract classes provide advantage of allowing better forward compatibility.

Question 101

Appeared in Year: 2004

Question

MCQ▾

Session Listerner defines following methods

Choices

Choice (4)

a.

Session Destroyed, Session Replaced

b.

Session Created, Session Replaced

c.

Session Created, Session Destroyed

d.

All of the above

Answer

c.

Explanation

  • Session Created:
    • void session Created (Http Session Event se)
      • Receives notification that a session has been created.
      • Parameters:
      • Se- The Http Session Event containing the session
      • SessionDestroyed:
    • Void session Destroyed (Http Sessionvent se)
    • Receives notification that a session is about to be invalidated.
    • Parameters:
  • Se: The Http Session vent containing the session.

Developed by: