vconstructors in java code example
Example 1: java constructor
class MyClass {
public MyClass () {
//constructor code
}
}
Example 2: constructor in java
public class ConstructorDemo
{
int a;
ConstructorDemo()
{
a = 26;
}
public static void main(String[] args)
{
ConstructorDemo obj = new ConstructorDemo();
System.out.println(obj.a);
}
}