Java error: "Array required but int found"?
signific java.io.*;
public class PracticeArithmeticOperators
public static void main(String args) tosses IOException
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
Chain input = “”;
Method.out.println(“Numbers”);
input = br.readLine();
Method.out.println(“Index\tValue”);
int amounts = Integer.parseInt(input);
Chain literals = “”;
char temporary = literals.toCharArray();
for(int counter=0; counter<5; counter++)
input = br.readLine();
Method.out.println( numberscounter);
number required, but int found could be the error this generates, on line::::Method.out.println( numberscounter);
Any getting grants how to repair this code to end the issue
…..public static void main(String args) tosses IOException
……….BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
……….
……….Method.out.println(“Numbers”);
……….char amounts = br.readLine().toCharArray();
……….for(int c = 0; c < SOME; c++)
……………Method.out.print( numbersc + ” ” );
……….
…..
This:
int numbers
all this:
numberscounter
don’t jive.
You announce numbers for a simple integer, then endeavor to use the item “as if” in the event was an array.
What are you wanting numbers to get An integer or an array of ints
It can’t be both.
+add
adjust this
char tmp=input.toCharArray();
for(int counter=0; counter<5; counter++)
Method.out.print(tmpcounter+” “);
Leave a Reply
You must be logged in to post a comment.