Exception messages | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Exception messages

In how many ways can we print exception messages in java ?

16th Feb 2018, 7:06 AM
Teja
2 Respostas
+ 1
One way is *ExceptionName*.getMessage(); If u name exception e that would be like e.getMessage(); That is the one that I use all the time.
16th Feb 2018, 7:16 AM
Sad
Sad - avatar
+ 1
I suggest printStackTrace() that gives you the error message and where the error occurred in the code. If your error is called e then the syntax is e.printStackTrace();
16th Feb 2018, 9:40 AM
Leonardo Medai Cossutta
Leonardo Medai Cossutta - avatar