Java Java Basics Perfecting the Prototype Parsing Integers

Evbarunegbe Kelvin
PRO
Evbarunegbe Kelvin
Pro Student 204 Points

parsingints.java

parsing integers

ParsingInts.java
int answer = Integer.parseInt(answerToLife);
String answerToLife = "42";

1 Answer

I don't know what is your question but the order is not right like this because the compiler wouldn't know what is the "answerToLife" so you should define (answerToLife) before parsing it to integer

String answerToLife = "42";
int answer = Integer.parseInt(answerToLife);