Incompatible types

Hello allThis piece of code is giving me an error called "Incompatible types", can anyone pls tell me what is wrong? i want to display the items in my linked list.Thanks! :-)
[195 byte] By [River_Platea] at [2007-11-27 9:46:14]
# 1

Lol i forgot to post the code....

import java.util.*;

public class Prob{

public static String insertar(){

Scanner sc = new Scanner(System.in);

LinkedList lista = new LinkedList();

System.out.println("Inserte nuevo estudiante");

lista.add("Dionis Matos/2002-0824/ISC");

lista.add(sc.next());

lista.add(sc.next());

lista.add("Perensejo de Tal/2003-1717/MER");

return lista;

}

public static void main(String args[]){

insertar();

}

}

River_Platea at 2007-7-12 23:56:17 > top of Java-index,Java Essentials,New To Java...
# 2
The method insertar has a return type of String, but you're trying to return a LinkedList
georgemca at 2007-7-12 23:56:17 > top of Java-index,Java Essentials,New To Java...
# 3
Thanks! got it now.. :-)
River_Platea at 2007-7-12 23:56:17 > top of Java-index,Java Essentials,New To Java...
# 4

[Hello again..

This time i've added a few more things to the mix... but the compiler now tells me that there's an illegal start of type, and also says "indentifier expected"

import java.util.*;

public class Uno{

public static String insertar(){

Scanner sc = new Scanner(System.in);

LinkedList lista = new LinkedList();

System.out.println("Inserte nuevo estudiante");

lista.add("Dionis Matos/2002-0824/ISC");

lista.add(sc.next());

lista.add("Perensejo de Tal/2003-1717/MER");

System.out.println(lista);

return " ";

}

public static void borrar(){

Scanner sca = new Scanner(System.in);

System.out.println("Desea borrar un estudiante de la lista? s/n");

String x = sca.next();

int y;

if(x.equals(s)){

System.out.println("Digite el numero del estudiante a borrar: 0 al 2");

int y = sca.nextInt();

if(y == 0){

lista.remove(0);

System.out.println(lista);

}

else if(y == 1 ){

lista.remove(1);

System.out.println(lista);

}

else if(y == 2){

lista.remove(2);

System.out.println(lista);

}

}

}// illegal start of type here

else{

System.out.print("No se borro ningun estudiante" + " " + lista);

}

public static void main(String args[]){

insertar();

borrar();

}

// Identifier expected here

}

How can i solve this?

River_Platea at 2007-7-12 23:56:17 > top of Java-index,Java Essentials,New To Java...
# 5

Jebus wept! That's a terrible way to fix your first problem! If you're not interested in the return value of insertar(), don't give it a return type. I suspect, though, that you really want it to return a List instead

The other problem looks like you've just missed a closing bracket on that borrar method. But the whole thing just doesn't make sense, what are you actually trying to do?

georgemca at 2007-7-12 23:56:17 > top of Java-index,Java Essentials,New To Java...