Explain the different forms of Polymorphism.



From a practical programming viewpoint, polymorphism exists in three distinct forms in Java:

  • Method overloading
  • Method overriding through inheritance
  • Method overriding through the Java interface

 
Question: What are Access Specifiers available in Java?
Answer: Access specifiers are keywords that determines the type of access to the member of a class. These are:
  • Public
  • Protected
  • Private
  • Defaults

 
Question: Describe the wrapper classes in Java.
Answer: Wrapper class is wrapper around a primitive data type. An instance of a wrapper class contains, or wraps, a primitive value of the corresponding type.
Following table lists the primitive types and the corresponding wrapper classes:
Primitive
Wrapper
boolean
  java.lang.Boolean
byte
  java.lang.Byte
char
  java.lang.Character
double
  java.lang.Double
float
  java.lang.Float
int
  java.lang.Integer
long
  java.lang.Long
short
  java.lang.Short
void
  java.lang.Void

No comments:

Post a Comment