-1
I’m making a simple application, and when it comes to using the methods of one class in another, it’s not working.
I have the following class:
import org.bson.Document;
import com.github.fakemongo.Fongo;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
public class Model {
Fongo fongo = new Fongo("mongo");
public void addEmpresario(Document user) {
MongoDatabase db = fongo.getDatabase("antenas");
MongoCollection<Document> empresario = db.getCollection("empresario");
empresario.insertOne(user);
}
}
And the main, which for now has nothing. How do I call this class in the main?
only you instantiate the class in the main Model model = new Model(), and so you use some class method you use model.addEmpresario(parameters)
– Luan Brito