How to Convert Object to Int in Java
- 1). In your preferred text editor, open the .JS or .JSP file in which you wish to perform the conversion.
- 2). Declare the value of the string object if you have not already done so. For example, assume you were working with a variable of "snum" with a value of 456. You would insert the following code:
String snum = "456"; - 3). Convert the string using the "Integer.valueOf" operator in the following format:
Integer intObj = Integer.valueOf(snum); - 4). Save and publish your file. Your Java applet will now declare an integer variable called "intObj," which is equal to the integer value of the your string object variable.
Source...