Exp 11
Exp 11
Exp 11
Write a program in JAVA to create a class Bird also declares the different
parameterized constructor to display the name of Birds
package Ladder;
ConstructorBird(String x) {
ConstructorBird(int y,String z) {
age=y; name=z;
System.out.println("this is the "+age+"years\t"+name);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
ConstructorBird a=new ConstructorBird();
a.ConstructorBird();
Viva Questions
Q.1 What is the constructor?
Q.2 How many types of constructors are used in Java?
Q.3 Is constructor inherited?
Q.4 What are the differences between the constructors and methods?