8

Possible Duplicate:
Converting string to int in java

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

public int returnInt(String s) {
}
Community
  • 1
  • 1
logic101
  • 211
  • 2
  • 7

1 Answers1

2

You can use Integer.valueOf(String) for this

Heiko Rupp
  • 30,426
  • 13
  • 82
  • 119
  • Thanks heiko but i am trying to write a method to use . – logic101 Apr 11 '11 at 14:44
  • 1
    @logic101 - Since you want to write the method itself, I assume it is homework. Read this post about [how to ask homework questions](http://meta.stackexchange.com/questions/10811/how-to-ask-and-answer-homework-questions) – Ishtar Apr 11 '11 at 14:56