Java Program For Constructor of Computer class

class Computer {
  Computer() {
    System.out.println("Constructor of Computer class.");
  void computer_method() {
    System.out.println("Power gone! Shut down your PC soon...");
  public static void main(String[] args) {
    Computer my = new Computer();
    Laptop your = new Laptop();
class Laptop {
  Laptop() {
    System.out.println("Constructor of Laptop class.");
  void laptop_method() {
    System.out.println("99% Battery available.");
Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Web Developer, Student and Mechanical Engineer. He Enjoys writing articles, Blogging, Solving Errors and Social Networking. Feel Free to let me know any of your concerns about hacking or let me know if you need any more methods on hacking anything. Enjoy Learning

No comments:

Post a Comment