Properties list(PrintStream) method in Java with Examples Last Updated : 23 May, 2019 Comments Improve Suggest changes Like Article Like Report The list(PrintStream) method of Properties class is used to print this Properties list out to the specified output stream, passed as the parameter. This method can be used for debugging purpose as it can help to see the Properties elements on the stream.0 Syntax: public void list(PrintStream out) Parameters: This method accepts a parameters PrintStream out which is the output stream on which the Properties elements are to be printed. Returns: This method just prints the elements and do not return anything. Below programs show the implementation of int list(PrintStream) method. Program 1: Java // Java code to show the implementation of // list(PrintStream) method import java.util.*; public class GfG { // Main method public static void main(String[] args) { // Create a properties and add some values Properties properties = new Properties(); properties.put("Pen", "10"); properties.put("Book", "500"); properties.put("Clothes", "400"); properties.put("Mobile", "5000"); // Print Properties details System.out.println("Properties: " + properties.toString()); System.out.println("listing out the Properties: "); properties.list(System.out); } } Output: Properties: {Book=500, Mobile=5000, Pen=10, Clothes=400} listing out the Properties: -- listing properties -- Book=500 Pen=10 Mobile=5000 Clothes=400 Program 2: Java // Java program to demonstrate // list(PrintStream) method. import java.util.*; public class GFG { // Main method public static void main(String[] args) { // Create a properties and add some values Properties properties = new Properties(); // Inserting elements into the properties properties.put("Geeks", "10"); properties.put("4", "15"); properties.put("Geeks", "20"); properties.put("Welcomes", "25"); properties.put("You", "30"); // Print Properties details System.out.println("Properties: " + properties.toString()); System.out.println("listing out the Properties: "); properties.list(System.out); } } Output: Properties: {You=30, Welcomes=25, 4=15, Geeks=20} listing out the Properties: -- listing properties -- You=30 4=15 Welcomes=25 Geeks=20 References: https://docs.oracle.com/javase/9/docs/api/java/util/Properties.html#list-java.io.PrintStream- Comment More infoAdvertise with us Next Article Properties list(PrintStream) method in Java with Examples K Kirti_Mangal Follow Improve Article Tags : Java Java - util package Java-Functions Java-Properties Practice Tags : Java Similar Reads Properties list(PrintWriter) method in Java with Examples The list(PrintWriter) method of Properties class is used to print this Properties list out to the specified output stream, passed as the parameter. This method can be used for debugging purpose as it can help to see the Properties elements on the stream.0 Syntax: public void list(PrintWriter out) Pa 2 min read PrintStream setError() method in Java with Examples The setError() method of PrintStream Class in Java is used to set the error state of this PrintStream instance. This method is used as an indicator to indicate that an error has occurred in the stream. It is protected and hence needs to be implemented by deriving the PrintStream class to use it. Syn 2 min read PrintStream print(String) method in Java with Examples The print(String) method of PrintStream Class in Java is used to print the specified String value on the stream. This String value is taken as a parameter. Syntax: public void print(String StringValue) Parameters: This method accepts a mandatory parameter StringValue which is the String value to be 2 min read PrintWriter print(long) method in Java with Examples The print(long) method of PrintWriter Class in Java is used to print the specified long value on the stream. This long value is taken as a parameter. This method is similar to write(String.valueOf(long)) where the String.valueOf(long) returns the number in bytes and these bytes are written on the St 2 min read PrintStream print(long) method in Java with Examples The print(long) method of PrintStream Class in Java is used to print the specified long value on the stream. This long value is taken as a parameter. Syntax: public void print(long longValue) Parameters: This method accepts a mandatory parameter longValue which is the long value to be written on the 2 min read Like