Java Program to Implement PrinterStateReasons API

This Java program is to Implement PrinterStateReasons API.Class PrinterStateReasons is a printing attribute class, a set of enumeration values, that provides additional information about the printer’s current state, i.e., information that augments the value of the printer’s PrinterState attribute.

Here is the source code of the Java program to Implement PrinterStateReasons API. The Java program is successfully compiled and run on a Linux system. The program output is also shown below.

System.out.println("the size of the printerStateReasons is "+ printerStateReasons.size());

printerStateReasons.clear();

if(printerStateReasons.isEmpty())

System.out.println("the printerStateReasons is empty");

else

System.out.println("the printerStateReasons is not empty");

}

}

advertisement

$ javac PrinterStateReasonsImpl.java
$ java PrinterStateReasonsImpl
the key set of the printerStateReasons is
input-tray-missing connecting-to-device cover-open
the values of the printerStateReasons is
warning error report
the entry set of the printerStateReasons is
input-tray-missing=warning
connecting-to-device=error
cover-open=report
the printerStateReasons contains Key CONNECTING_TO_DEVICE :true
the printerStateReasons contains Value ERROR :true
the size of the printerStateReasons is 3
the printerStateReasons is empty

Sanfoundry Global Education & Learning Series – 1000 Java Programs.

advertisement

If you wish to look at all Java Programming examples, go to Java Programs.