Computer Science, asked by GoodCharm, 2 months ago

please help!
ASAP ASAP ASAP
thanks!​

Attachments:

Answers

Answered by BrainlyProgrammer
5

Given Códe:-

String s="1001";

int x=Integer.valueOf(s);

double y=Double.valueOf(s);

System.out.println("x="+x);

System.out.println("y="+y);

Required Output:-

1001

1001.0

Explaination:-

valueOf() returns the integer number present in the string.

Note:-

  • If you write s="A" then you will get NumberFormatException because A is alphanumeric.
Similar questions