0
Here’s the thing, I have two classes: Account.java and Program1.java the idea is for the Program1 class to create an Account instance and use it within the program but I’m not able to compile the Program1 class by the prompt (I’m not using IDE).
Java account.:
package generico;
class Conta {
int numero;
String titular;
double saldo;
}
Program1.java:
package generico;
class Programa1{
public static void main(String args[]){
Conta minhaConta;
minhaConta = new Conta();
minhaConta.titular = "Duke";
minhaConta.saldo = 1000.0;
System.out.println("Saldo atual: " + minhaConta.saldo)
}
}
The following error appears when I try to compile Program1.java:
Programa1.java:5: error: cannot find symbol
Conta minhaConta;
^
symbol: class Conta
location: class Programa1
Programa1.java:6: error: cannot find symbol
minhaConta = new Conta();
^
symbol: class Conta
location: class Programa1
2 errors
error: compilation failed
Calde the "public" in the class names?
– user28595
Remove the package q works.
– user28595