| Author |
I don't know how to use try/catch
|
André Asantos
Ranch Hand
Joined: Nov 23, 2009
Posts: 234
|
|
please, i would like to know how to configure way to return a message to the user when types a wrong number as 1.5 or when don't exist the number
typed...
metodo main
|
André AS
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
here, there is no reason to use try/catch . what is the use of catching a NullPointerException ?
|
 |
André Asantos
Ranch Hand
Joined: Nov 23, 2009
Posts: 234
|
|
Hmmm
but how could I treat that situation please?
bye,
André AS
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Use == null and/or != null to make sure none of the variables is null.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
Some remarks: What exactly is the purpose of your getCliente() method - what should it do and what should it return? Note that as it is written above, the method effectively does nothing at all - it always returns the same Cliente object that you passed into it.
In line 4, why are you creating a new Cliente object? You're not using that object anywhere, and in line 7 you're assigning a different value to variable c, throwing away the Cliente object that you created earlier.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: I don't know how to use try/catch
|
|
|