I have created a method, but Java doesn't see it - Java -


i have been learning programming while thenewboston , in 80th tutorial hew writing files. followed code word word, eclipse says method undefined the type "creatfile". have checked on , on see, can't see problem. here code.

creatfile.java

import java.util.formatter;  public class creatfile {  private formatter x;  public void openfile(){     try{         x = new formatter("chinese.txt");     }     catch(exception e){         system.out.println("you have error");     }  public void addrecords() { //there error on "void" , "addrecords"     x.format("%s%s%s", "20 ", "jacob ", " peterson"); } public void closefile(){ //error here     x.close();     }   } } 

apple.java (my main class)

import java.util.*;  public class apples {     public static void main(string[] args) {         creatfile g =  new creatfile() {             g.openfile();             g.addrecords();             g.closefile();         }     } } 

your main method doesn't make sense. try this:

public class apples {     public static void main(string[] args) {         creatfile g =  new creatfile();         g.openfile();         g.addrecords();         g.closefile();     } } 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -