Output

Date and Time

Introduction: This page will teach you about using the Date import in Java to output or get the current Time and/or Date. When is this needed? Adding a simple clock or date counter to an application adds a slightly more professional look to the overall appeal of the program, as well as having the time handy is always a good thing. What imports are needed? The imports we need to get the current Date and Time are;
  1. import

Writing Output to a Text File in Java

Many times it is important to write output to a file to be saved. This is commonplace in just about every kind of Java application - from business to games. It allows the users information/status/progress to be saved or recorded for future reference. In order for this to work, the simplest solution is to create a file in the same folder as the Java program. For this example, we are going to create an output file called output.txt.