owny Posted October 18, 2009 at 06:40 PM Report Share #292226 Posted October 18, 2009 at 06:40 PM Boa noite, Estou a começar em JAVA e gostaria de saber o seguinte: Tenho um package e lá dentro tenho 4 classes. -Quero chamar um metodo na classe Main que se encontra numa das outras classes. Como fasso isso? Link to comment Share on other sites More sharing options...
Baderous Posted October 18, 2009 at 06:49 PM Report Share #292228 Posted October 18, 2009 at 06:49 PM Crias uma instância da classe onde está definido o método e de seguida invocas o método sobre a instância criada. Link to comment Share on other sites More sharing options...
owny Posted October 18, 2009 at 11:31 PM Author Report Share #292262 Posted October 18, 2009 at 11:31 PM podes dar-me umas luzes? Link to comment Share on other sites More sharing options...
Baderous Posted October 18, 2009 at 11:35 PM Report Share #292264 Posted October 18, 2009 at 11:35 PM public class Main { ClassA instancia = new ClassA(); instancia.metodo(); } Link to comment Share on other sites More sharing options...
owny Posted October 19, 2009 at 11:37 AM Author Report Share #292316 Posted October 19, 2009 at 11:37 AM Thanks 😁 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now