Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Formatter;
- class CreateFiles {
- public static void main(String args[ ]) {
- Create f = new Create();
- f.openFile();
- f.recordFile();
- f.closeFile();
- }
- }
- class Create {
- private Formatter f;
- void openFile() {
- try {
- f = new Formatter("U1.txt");
- } catch(Exception e) {
- System.out.println("You have an error");
- }
- }
- void recordFile() {
- f.format("%s %s %s", "Mr", "Somebody", "20");
- }
- void closeFile() {
- f.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement