सीधे मुख्य सामग्री पर जाएं

#42 Types of Constructor in Java | What is Default Constructor in Java ?

package com.sudhirtheindian2.java123;

public class javaConstructor {

int a;
String name;
boolean f;
javaConstructor(){
a=10;
name="india";
f=true;

}

void display(){
System.out.println(a+" "+name+" "+f);
}

public static void main(String[] args) {


javaConstructor jc = new javaConstructor();
jc.display();
// Types of constructor in java ----
// and what is default constructor

// 1 private constructor
// 2 default constructor
// 3 parametrized constructor
// 4 copy constructor


// what is default constructor
//

// a constructor which does not have any parameter
// is called default constructor

// syntax----
// class A{
//
// A(){
//
// }
// }






}

// syntax of default constructor







}

टिप्पणियाँ

इस ब्लॉग से लोकप्रिय पोस्ट