The quieter you are, the more you are able to hear.
Tony Docherty wrote:If you are posting code that doesn't compile please state so and also supply the compiler error messages.
It won't compile because you can't use variable 'a' before declaring it.
BTW If you want to fill an array with user input values you will need a loop to repeatedly get the user's input and put the value into the array.
I declare it s a = array[i]
Tony Docherty wrote:The code you posted is not valid Java, it doesn't compile.
Tony Docherty wrote:Do you understand the difference between these two code examples:
and when i excute it the numbers of the index is not on the same line of value..
plus , the numbers or items of the array is written by the computer i want by the me (by the keyboard);
Abz Aka wrote: plus , the numbers or items of the array is written by the computer i want by the me (by the keyboard);
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Tony Docherty wrote:Your first code was nearly correct, I supplied the two for loop code blocks so you could see the difference curly braces made as you didn't appear to understand my instructions about what you needed to do to your code. They were not for you to copy into your code they were just to show how adding curly braces changed what code was executed inside the loop.
Abz Aka wrote:now Do can i make with scanner or i need to use ((arraylist,arrayread,and these things))))to add items??
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
The quieter you are, the more you are able to hear.
Abz Aka wrote:.it's just that i insist to enter the data by (((scanner))) and all my trys are wrong ,,there is some solutions on Google but it's advanced and new to me ..that's all
now Do can i make with scanner or i need to use ((arraylist,arrayread,and these things))))to add items??
Nothing up my sleeve ... and ... presto! A tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|