Thursday, 18 August 2016

java - method to convert from a string to an int












I am trying to write a method that returns an int from a String variable.
My method is:



public int returnInt(String s) {
}

Answer



You can use Integer.valueOf(String) for this


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...