4 B. Designed a class that demonstrates the use of constructor and destructor.

 Program: 


public class Prac4b 

public Prac4b() 

{ System.out.println("Hello"); } 


public void finalize() 

{ System.out.println("Destroyed"); } 


public static void main(String[] args) 

Prac4b obj=new Prac4b(); 

obj=null; 

System.gc(); 

}

}

Comments

Popular posts from this blog

Program using Light Sensitive Sensors on Tinkercad

Custom Buttons in Android

Blink LED pattern using Arduino on Tinkercad