Java Questions

  1. What is Operator?
  • Answer:
  • Operators are special symbols that perform specific operations on one or multiple operands, and then return a result.
Added By : Deeksha

  1. What are the primitive data types supported by the Java programming language?
  • Answer:
  • The eight primitive data types are supproted by Java Programming Language:

     byte - It is 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127.

     short - It is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767.

     int - It is a 32-bit signed two's complement integer. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647.

     long - It is a 64-bit signed two's complement integer. It has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807.

     float - It is a single-precision 32-bit IEEE 754 floating point.

     double - It is a single-precision 64-bit IEEE 754 floating point

     boolean - boolean data type has two possible values: true and false.

     char - It is a single 16-bit Unicode character.

Added By : Deeksha


  1. What is an array?
  • Answer:
  • An array is an object that holds a fixed number of values of a single data type.

    Specify length of array when array is created. Each item array is called an element. Array element access through index. Array index numbering begins with 0.

Added By : Deeksha

  1. What is Encapsulation?
  • Answer:
  • Hiding internal data from the outside world, and accessing it only through publicly exposed methods is known as data Encapsulation.
Added By : Prashant

  1. What is package?
  • Answer:
  • A package is a namespace that organizes a set of related classes and interfaces.
Added By : Prashant

  1. What is interface?
  • Answer:
  • An interface is a reference type, similar to a class, that can contain only constants, method signatures, and nested types.

    There are no method bodies. Interfaces cannot be instantiated - they can only be implemented by classes or extended by other interfaces.

Added By : Prashant


  1. What is Class?
  • Answer:
  • A class is a prototype from which object is created.
Added By : Prashant

  1. What are the benefit of Object?
  • Answer:
  • Modularity - an object can be written and maintained independently from the source code of other objects.

    Information-hiding - only interact with object's methods. Details of object remains hidden.

    Code reuseability

Added By : Prashant

Post Your Question
Social Sharing
Search