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


Write in Short

Short Answer▾

What is the base class for all swing components?


  • Swing components are derived from abstract javax. swing. Jcomponet class.
  • Which has following hierarchy:

java. lang. Object

java. awt. component

java. awt. container

javax. swing. jcomponent

It replaces selection of AWT GUI components.

Question 42


Describe in Detail


What is the difference between abstract class and interface?


Table of Difference between Abstract Class and Interface
Interface (Java)Abstract class (C ++)
Supports multiple inheritanceNo support for multiple inheritance
No data membersContains data members
No constructorsContains constructors
Contains only incomplete membersContains both incomplete and complete members.
Members of interface cannot be staticMembers of abstract class can be static.

Question 43


Describe in Detail


To get string of words.


  • To get string of words is Gets () .
  • Gets () accepts single or multiple characters of string including spaces from the standard input device.

    How to declare:

gets (variable_name) ;

Example of declaration:

char ch [10] ;

gets (ch) ;

  • Gets () read string from the screen.
  • Gets () statement encounters the characters entered by user will be copied into the variable.
  • Gets () uses stdin (Standard Input Output) as source, but it does not include the ending newline character in the resulting string and does not allow to specify a maximum size for string variable.

Developed by: