Define mouse , keyboard , The rules of notebook
interface USB { void open();// Open function void close();// Turn off the function }
Mouse implementation USB rule
class Mouse implements USB { public void open() { System.out.println(" Mouse on ");
} public void close() { System.out.println(" Mouse off "); } }

Keyboard implementation USB rule  
class KeyBoard implements USB { public void open() {
System.out.println(" Keyboard on "); } public void close() { System.out.println(" Keyboard off ");
} }

  Define notebook
class NoteBook { // Notebook open operation function public void run() { System.out.println(" Notebook running ");
} // Notebook use usb equipment , When the notebook object calls this function , It must be passed a match USB Regular USB equipment public void useUSB(USB
usb) { // Judge whether there is USB equipment if (usb != null) {; usb.close(); } } public
void shutDown() { System.out.println(" Notebook off "); } }
public class Test { public static void main(String[] args) { // Create notebook entity object
NoteBook nb = new NoteBook(); // Notebook on; // Create a mouse entity object Mouse m = new
Mouse(); // Notebook using mouse nb.useUSB(m); // Create keyboard entity object KeyBoard kb = new KeyBoard(); //
Notebook using keyboard nb.useUSB(kb); // Notebook off nb.shutDown(); } }

©2020 ioDraw All rights reserved
Self made whole person computer program PHP call shell command python Simple record of network programming layui.table Examples of dynamically getting header and list data Big data environment --- data warehouse (hive+mysql+hadoop) The construction of What are the types of variables ?MYSQL database DML Common commands 《 From machine learning to deep learning 》 note (2) Unsupervised learning log4j Method of printing exception stack information Android Development — Display food information according to customer budget