Skip to content

Instantly share code, notes, and snippets.

@guaracyalima
Last active November 24, 2019 22:57
Show Gist options
  • Save guaracyalima/71e8bf5e79ec5ddffdb4f886dbfc6070 to your computer and use it in GitHub Desktop.
Save guaracyalima/71e8bf5e79ec5ddffdb4f886dbfc6070 to your computer and use it in GitHub Desktop.

Considerações a respeito do método main

Os itens abaixo apresentam erro em tempo de execução, ou seja, COMPILAM, porém NÃO EXECUTA

  • O método main deve sempre conter a palavra static

https://gist.github.com/a2daeb168efc31320865e65525e4aac3

  • Deve ter sempre o tipo de retorno void

https://gist.github.com/213fedc4bb94ce7e0274267217f29c4f

  • Deve ser sempre public:

https://gist.github.com/fb2b3380a7c30b8e5e1be7b6f5e3956a

Erro de compilação:

  • Mudar a posição do retorno public void static main(String args[ ]) gera um erro em tempo de compilação

Alterações que funcionam

  • O método main pode ser final
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment