Languages-Java [3i Infotech Placement]: Sample Questions 5 - 6 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 5

Edit

Describe in Detail

Essay▾

Which method is used to call the constructors of the superclass from the subclass?

Explanation

  • Super (argument) method is used to call the constructors of the superclass from the subclass.
  • This is used inside a sub class method definition to call a method in the super class.
  • Private methods of the super-class cannot be called.
  • Public and protected methods can be called by the super keyword.
  • It is used by class constructors to invoke constructors of its parent class.

Syntax:

super . method-name ( [zero or more arguments] ) ;

OR

super ( [zero or more arguments] ) ;

Question 6

Edit

Describe in Detail

Essay▾

What is difference between process and thread?

Explanation

Table of Difference between Process and Thread
ProcessThread
Heavy weightLight weight
Has its own memory space.Use memory of the process they belong to
Inter process communication is slow as processes have different memory address.Inter thread communication is fast as threads of the same process share the same memory address.
Context switching between the process is more expensive.Context switching between threads of the same process is less expensive.
Processes don՚t share the memory with other process- consider privacy and securityThreads share the memory with other threads of the same process- consider privacy and security

Developed by: