I'm studying again some OOP concepts so I made this simple code just to see how overriding methods work and surprise, it's not working. Also, just ignore the fact that the class name is HelloWorld, it's just a file for studying purposes. It's already changed to Filha.java btw
class HelloWorld {
public static void imprimir() {
System.out.println("Oie");
}//
public static void imprime(int a) {
System.out.println("27");
}//
}//
public class Filha extends HelloWorld {
public static void main(String[] args) {
imprimir();
imprime(55);
}//
@Override
public static void imprimir() {
System.out.println("Ola");
}//
@Override
public static void imprime(int num) {
System.out.println(num);
}//
}//
Yesterday, the error was Exception in thread "main" java.lang.Error: Unresolved compilation problem in the public static void main(String[] args) { line, but I turned off my computer, turned it on today and it's not there anymore.
Now the error is The method imprimir() of type Filha must override or implement a supertype method for the public static void imprimir() { line. There's also the error in the main method where it's calling imprimir(), as expected.
I don't really know what other information to give since it's a simple code with a simple problem (I believe), it's also my first question so if I'm leaving anything out please ask and I'll be more throughout.