I have a file "poo1.java":
package pootest;
public class init{
public static void main(String[] args){
Caneta bic1 = new Caneta();
bic1.cor = "azul";
bic1.tampada = true;
bic1.ponta = 0.5f;
bic1.carga = 45;
bic1.modelo = "comun";
bic1.rabiscar();
}
}
and another file "pen.java":
package pootest;
class Caneta{
String modelo;
String cor;
float ponta;
int carga;
boolean tampada = true;
void tampar(boolean estado){
tampada = estado;
}
void rabiscar(){
if (tampada){
System.out.print("ta tampada seu jumnet$
} else{
System.out.print("boiolage");
}
}
}
When I compile the poo1.java (javac poo1.java) into the terminal this is the output:
poo1.java:3: error: class init is public, should be declared in a file named init.java public class init { ^ poo1.java:5: error: can not find symbol Pen bic1 = new Pen (); ^ symbol: class Pen location: class init poo1.java:5: error: can not find symbol Pen bic1 = new Pen (); ^ symbol: class Pen location: class init 3 errors