system.out.println (""); syntax error

-1

I started learning Java with Elipse and I am learning more and more. But I came across a situation: when I use system.out.println(""); , Eclipse "says" that there is a syntax error and I have no idea what that can be. I've tried using shortcut "syso" + Ctrl + Space but neither option appears. I looked for answers on this and other sites but I did not find my problem.

The version of Eclipse I use is the Eclipse IDE for Java EE Developers (Mars).

I will post an image showing the syntax error that appears along with the code.

Thankyouinadvance!Thankyouforyourattention.

Codebelow:

packagecadastro;//08importjava.util.ArrayList;importjava.util.HashMap;importdados.Cliente;importdados.Produto;importdados.Venda;importutilitarios.Console;publicclassCadastro{publicstaticHashMap<String,Cliente>listaCliente=newHashMap<>();publicstaticHashMap<Integer,Produto>listaProduto=newHashMap<>();publicstaticHashMap<Integer,Venda>listaVenda=newHashMap<>();publicstaticvoidincluirCliente(Clienteobj){listaCliente.put(obj.getCpf(),obj);}publicstaticvoidexcluirCliente(Clienteobj){listaCliente.remove(obj);}publicstaticArrayList<Cliente>pesqClienteCpf(Stringcpf){ArrayList<Cliente>resposta=newArrayList<>();for(Clienteobj:listaCliente.values()){if(obj.getCpf().contains(cpf)){resposta.add(obj);}}returnresposta;}//11publicstaticArrayList<Cliente>pesqClienteNome(Stringnome){ArrayList<Cliente>resposta=newArrayList<>();for(Clienteobj:listaCliente.values()){if(obj.getNome().contains(nome)){resposta.add(obj);}}returnresposta;}publicstaticvoidincluirProduto(Produtoobj){listaProduto.put(obj.getCodigo(),obj);}publicstaticvoidexcluirProduto(Produtoobj){listaProduto.remove(obj.getCodigo());}publicstaticArrayList<Produto>pesqProdutoCodigo(intproduto){ArrayList<Produto>resposta=newArrayList<>();for(Produtoobj:listaProduto.values()){if(obj.getCodigo()==produto){resposta.add(obj);}}returnresposta;}publicstaticvoidincluirVenda(Vendaobj){listaVenda.put(obj.getNumVenda(),obj);}publicstaticvoidexcluirVenda(Vendaobj){listaVenda.remove(obj.getNumVenda());}system.out.println("asdasd");
}
    
asked by anonymous 12.05.2016 / 00:44

3 answers

3

Java is a case sensitive language. Words with upper and lower case letters make a difference.

Correct: System.out.println("asdasd");

Wrong: system.out.println("asdasd");

When you can, search for Java Conventions on Google, you will understand how fields, classes, variables are named, and learn about good practices and name patterns ...

    
11.12.2016 / 02:04
3

You are calling the method in the body of the class , so the alert. Call System.out.println(""); inside some method or constructor of your class Cadastro .

    
17.05.2016 / 04:36
1

Your problem is very simple and it happens to most people starting in the Java world.

The System.out.println ("") method; starts with the capital "S" of the System Class. Try with a capital "S" and it will work.

    
12.05.2016 / 00:49