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

Edit

Write in Short

Short Answer▾

Why do you use canvas?

Explanation

  • Canvas represents a blank rectangular area where the application can draw or trap input events from the user.
  • An application must subclass the canvas in order to get useful functionality creating a custom component.
  • The paint method is overridden in order in order to perform custom graphics on the canvas.

Declaration class:

public class Canvas

extends Component

implements Accessible

Question 125

Edit

Describe in Detail

Essay▾

What modifiers may be used with an inner class that is a member of an outer class?

Explanation

Understanding of Inner Class and Outer Class
  • Inner classes is a full-fledged member of the enclosing class.
  • Can be marked with any access modifier including abstract or final modifiers.
  • But an inner class cannot contain any static members.

Syntax of Inner Class

Class outer_demo

{

Class nested_demo

{

}

}

Question 126

Edit

Describe in Detail

Essay▾

What are abstract classes?

Explanation

  • Abstract classes are those for which instances can՚t be created.
  • Class declared abstract may or may not include abstract methods.
  • An abstract method is declared without an implementation
  • In object-oriented programming (OOP) , classes represent objects in the domain of the problem.
  • Classes are collections of attributes and behaviours based on previously-defined classes.
  • Programmers use inheritance to derive the specific implementation of abstract classes.
  • Classes derived from abstract classes are called derived classes.
  • Principle applied many times in succession results in a hierarchy of classes.

Developed by: