Number Parsing
Integer
user input
|
Enter an integer:-34 You entered -34 Enter an integer:five Sorry, but 'five' is not an integer. |
No. 180
Why using String userInput =
null
?
Q: |
The former listing initializes the
So the dummy assignment |
A: |
Value: 13 |
Exception in thread "main" java.lang.NumberFormatException: For input string: "201" ... at de.hdm_stuttgart.sd1... |
No. 181
Parsing short
values
Q: |
Which outcome do you expect? Try to answer without prior execution.
Explain the result. |
A: |
No. 182
Parsing short
values in hexadecimal
representation
Q: |
An image processing application yields the following type of data:
We are looking for a class method parsing these hex values
and converting them to
The provided sample data may then be processed like:
Result: C9: 201 AF3: 2803 B: 11 TipHave a look to the binary parse example and think about representations. |
A: |
|
A: |