Answer to Question #46966 in Java | JSP | JSF for neha reddy

Question #46966
Use Java code to write a function that converts an array of Strings to an array of integers. Example: arr = {“40”, ”50“, ”70”} to arr = {40,50,70}.
1
Expert's answer
2014-09-29T01:15:55-0400
The answer to the question is available in the PDF file https://www.assignmentexpert.com/homework-answers/programming-answer-46966.pdf

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
06.10.14, 14:50

Dear Rkosamia,
You're welcome. We are glad to be helpful. 
If you liked our service please press like-button beside answer field. Thank you!

Rkosamia
04.10.14, 03:18

Thank u so much...

Assignment Expert
02.10.14, 20:37

Dear Rkosamia,
you should create a project with a class where the main method

public static void main(String[] args) {

}

exists and place a call of the convertsArray function here, like in the following manner:
public class temp {
public static void main(String[] args) {
String [] arr = {"40", "50", "60"};
int[] iarr  = convertsArray(arr);
for (int i = 0; i < iarr.length; i ++) {
System.out.println(iarr[i]);
}
}
public static int[] convertsArray(String[] strArr) {
int[] iArray=new int[strArr.length]; 
for(int i=0; i<strArr.length; i++) { 
iArray[i] = Integer.parseInt(strArr[i]); 

return iArray; 
}
}

rkosamia
02.10.14, 04:37

your answer is correct i know that ., but in my netbeans IDE , it shows error about " there is no main method in class"

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal