what is Multiple Classes in java tutorial
Java program can contain more than one i.e. multiple classes. Following example Java program contain two classes: Computer and Laptop. Both classes have their own constructors and a method. In main method we create object of two classes and call their methods.
Using two classes in Java program
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();
my.computer_method();
your.laptop_method();
}
}
class Laptop {
Laptop() {
System.out.println("Constructor of Laptop class.");
}
void laptop_method() {
System.out.println("99% Battery available.");
}
}
----------------------------------------------------------------------
learn Complete java Tutorial Course in 8 hours
For Watch and Learn More videos
+++++++++++++++++++++++++++++++++++
Android Development Complete Course
Complete course c++ programming learn
Ethical Hacking with kali
Subscribe our channel
visit our website nextsoltech.com/learn
Auf dieser Seite können Sie das Online-Video Java Programming Tutorial 14 Using Multiple Classes -- learn java Course in 8 hours mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Next Tutorials 12 Oktober 2017 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 27 Mal angesehen und es wurde von 1 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!