Re: Possibly a noobish issue
Your inner class string does nothing.
Does tipo mean type?
conta was never defined as a variable in the main method, at least not before you used it, so it won't know what to do with it.
Re: Possibly a noobish issue
scan.nextLine();
This scans but doesn't set it to anything.
String str = "";
and then later
str = scan.nextLine(); will at least set it to something
Re: Possibly a noobish issue
for(int i=0;i<5;i++){
agenda[i]=insereContacto();
scan.nextLine();
conta++;
}
do you mean i < 50?
Otherwise, there will be 50 agenda, but only 5 will have values.
if (pos==-1)
should be replaced by
if (pos >=0 && pos < agenda.length)
else
imprimeContacto(agenda[pos]);
this won't work unless you have all 50 values as my if statement above will let it work and not get a compiler error,
but if they enter like 30, you've got nothing in index 30 so it'll throw a Null Pointer Exception.
Re: Possibly a noobish issue
Java already has a class called String, with a capital S. You don't need to write your own, unless you have to.
Re: Possibly a noobish issue
if (c.isMovel()==true)
Actually, boolean method can be written
if (c.isMovel())
if checking to see if true
and
if (!c.isMovel())
if checking to see if false
Re: Possibly a noobish issue
cannot find symbol
symbol: constructor Contacto(java.lang.String,int,boolean)
location: class Aula_Teo.Contacto
I think this means that you had an inner class called string, and maybe you called it.
You forgot to capitalize String.
When it pass it a String,
it expected a type of type "string".
Re: Possibly a noobish issue
javapenguin is correct.... Delete your inner string class.... and then change the type in the constructor from string to String