Core Java - Interview Questions and Answers


  1. What do you understand by private, protected and public?
    These are accessibility modifiers. Private is the most restrictive, while public is the least restrictive. There is no real difference between protected and the default type (also known as package protected) within the context of the same package, however the protected keyword allows visibility to a derived class in a different package.
  2. What is Downcasting ?
    Downcasting is the casting from a general to a more specific type, i.e. casting down the hierarchy
  3. What modifiers may be used with an inner class that is a member of an outer class?
    A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.
  4. How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?

    Unicode requires 16 bits and ASCII require 7 bits Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits.

    UTF-8 represents characters using 8, 16, and 18 bit patterns.

    UTF-16 uses 16-bit and larger bit patterns.

  5. What restrictions are placed on the location of a package statement within a source code file?
    A package statement must appear as the first line in a source code file (excluding blank lines and comments).
  6. What is a native method?
    A native method is a method that is implemented in a language other than Java.

« Prev   [ Page 13 of 22  Jump... Next »

Jump to page : 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |