anonymous
  • anonymous
please help me!!!!! the question in attachment
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
1 Attachment
anonymous
  • anonymous
what the wrong ? import java.util.Scanner; public class Task2 { public static void main(String [] args){ Scanner input = new Scanner(System.in); System.out.println(" Size of Array : "); int in=input.nextInt(); int List[]= new int [size]; } public static boolean isSorted(int[] list){ boolean sorted = true; for (int i = 1; i < list.size(); i++) { if (list.get(i-1).compareTo(list.get(i)) != 1) sorted = false; } return sorted; } } }}
anonymous
  • anonymous
Without actually testing it, I can see that you have "int List[]= new int [size];" Note that you do not have a "size" variable :) You need to use the "in" variable which the user input first. After that, you also need to ask for the other numbers which the user will enter. You could create an for loop which will get "in"-number of variables that the user has typed in. To help you further, you should provide the error message you get when you run the program.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
here the error message which i get
1 Attachment
anonymous
  • anonymous
Change the [size] to [in]. To find out what is wrong with your program, you should read the message and look for red curly brackets underneath variables. If you hover your mouse over them, further information about what is wrong can be provided.
e.mccormick
  • e.mccormick
Or, from a logical standpoint, change the input line from in to size. This makes the variable name state what it is for.
e.mccormick
  • e.mccormick
Also, it looks like you are using Eclipse. As Ivanskodje points out, that should make hover work for errors. Watch for the red underlines. Let me make an error in some exiting code and show you what that is like.
e.mccormick
  • e.mccormick
You can also see on the left, near the line numbers, the error marker. There is another on the right, nect to the scroll bar, that gives a general idea of where in the file. So the ones on the right always show up where as the one on the left only shows when you can see the part of the file with the error.

Looking for something else?

Not the answer you are looking for? Search for more explanations.