array 17 « array « Java Collection Q&A

Home
Java Collection Q&A
1.algorithm
2.array
3.Array Byte
4.Array Char
5.Array Convert
6.Array Dimension
7.Array Integer
8.Array Object
9.Array String
10.ArrayList
11.collection
12.comparator
13.Development
14.Garbage Collection
15.Generic
16.hash
17.HashMap
18.HashTable
19.iterator
20.LinkedList
21.List
22.Map
23.queue
24.Set
25.Sort
26.tree
Java Collection Q&A » array » array 17 

1. help Array    forums.oracle.com

2. Arrays in a do...while    forums.oracle.com

Well, yeah, but I find it hard to believe that the assignment just said "hey, just throw an array in there randomly somehow. Cowabunga dude!" Keep in mind that homework assignments often ask for very specific implementations, or make arbitrary and often bizarre restrictions that you wouldn't do in real life. Just quote the actual assignment.

3. arrays    forums.oracle.com

That's kind of a run-on paragraph. Let's summarize: 1. Arrays or collections can hold most anything you can dream of. 2. What is your goal? Is it to use an array or to save data to a file? Realize that the second doesn't necessarily imply the first. 3. Getting numerical information from a JTextArea seems to be putting the cart before ...

4. arrays    forums.oracle.com

> my code isn't working so i thought maybe it might have been the method, which is supposed to return an array Right. As mentioned in that case, it's a good idea to ask a specific question about the actual code, rather than a general question about what is possible in Java. It saves some time jockeying around to find out ...

5. arrays    forums.oracle.com

Your calculate method declares that it takes a boolean and int array, and you are passing it a boolean and an int (not arrays). Edit: You need to modify your method to take the primitives and not the arrays, and get rid of the loop in the method. As it is written, even if you did pass arrays, you would only ...

6. Some help with basic array operations    forums.oracle.com

Im stuck on a fairly easy array method, Im trying to get the last value of an array what I had so far was: public static int lastLocation(int a[]) { int last = a.length-1; return a[last]; } and it keeps coming up ArrayIndex o.b.e, and i cant seem to get it to properly work and one more method, In the same ...

7. bounded arrays    forums.oracle.com

dear All, please , can anybody know a general formula for the bounded arrays (row wise) ??? sorry it is a mathematical question more than programming , but i thought maybe one of u had implemented bounded arrays before and maybe i can find some help. i would be so grateful if anybody helped.. thanks D_Roth.

8. Dought in Array    forums.oracle.com

9. My first array problem...    forums.oracle.com

10. Arrays    forums.oracle.com

I really need some help with my project. It should be a very easy program, but no matter what I read online or in my books, I don't seem to be able to grasp the idea of arrays. I don't get how to use them at all. Here's the program: Write a program that will accept up to ten names (first ...

11. three dimesional array^_^    forums.oracle.com

12. odd & even array    forums.oracle.com

13. Fixed Array help!!!    forums.oracle.com

15. Fixed-sized array    forums.oracle.com

Hi all, I am after a bit of help. I have a fixed sized array of 11. Each position is a month. I need a variable set to 0, and the system searches through the array and if the number is bigger than the current highest figure passes it to it. When it gets to the end it prints out the ...

16. Complex Arrays    forums.oracle.com

I need an array structure that will allow the following... I have 8 "teams" each with 3 "stats"... i need to be able to remove the "teams" from the list/array... the stats will remain constant based on each team... i need to be able to read the stats for each team from a text file which is already created... im thinking ...

17. arrays    forums.oracle.com

You don't have 3 arrays to choose from. [index 1] tells it FROM WHICH { ..... } to grab from. [index 2] tells it which item to grab from that bracket. Try planets[1][0] -first, you're telling it you want {BracketSet 1}, which is really the second array since the first is always 0. -Now you want the 0th (first) item.

18. array    forums.oracle.com

19. Array question    forums.oracle.com

20. spliting the array into two arrays    forums.oracle.com

If the array is ordered, you can use java.util.Arrays.binarySearch() with the parameter and a Comparator if ordering is not natural. if index is negative, the -1-index is the site where the object should be placed and otherwise, the index is the siste where the object is placed. Create two same type arrays with the size appropriate and store original objects with ...

21. my array    forums.oracle.com

Given the low number of possibilities I'd hoped you try to find out yourself... Even now that code has been posted in a reply, maybe you should still try out all the possibilties to see what happens. There are really only a few choices: 1. before the loop 2. in the loop 3. after the loop Try some variants of these ...

22. Arranging an array differently    forums.oracle.com

public static void main(String args[]) throws IOException { Random r = new Random(); //Arrays A = new Arrays(); int[] able = new int[500]; int amount = 50+r.nextInt(30); for(int i=0; i

24. Array get methods    forums.oracle.com

25. arrays    forums.oracle.com

26. quick array question    forums.oracle.com

27. Arrays    forums.oracle.com

28. Some problems with array    forums.oracle.com

File file = (File)fileList.get(i); It complains Incompatible data type. So I cannot assign the file names to file array inside the loop. I think there could be fairy simple and straight forward way to resolve this. But since I am not so familiar with the java language it is quite a headache for me. Can anyone suggest me a solution?

29. Array and Function    forums.oracle.com

Hi! I'm new in JAVA Can anyone assist me? 1. How to reads ten numbers (integer) that enter by the user, calculate the average and display it, and finds out how many numbers are above the average also display it. 2. Reads ten integers enter by the user and display it in reverse order. Really need your assistance! Thanks and Best ...

30. Info. regarding Arrays    forums.oracle.com

Hi! it is my first question. I am new to java. I have a basic question regarding arrays. what is "length" property of arrays? is it a property or method? how it is able to store dynamically the length of any array. I am just confused. let me have a detail explanation. Thank you.

31. array problem    forums.oracle.com

The else part where you check the user input looks a little odd. You are repeating the prompt and doing nothing else. This explains why you see two prompts printed one after the other. (The prompt you repeat then the prompt from the next time round the loop.) Perhaps it would be better to print a message explaining the valid input ...

32. Problem with arrays    forums.oracle.com

Why not. Basically the formula was generating an index to the array from 0 to range (range being the max). If you then add one you will go beyond the maximum value. Hence out of bounds. Also, bad idea to give variables and methods (and classes) the same name. It leads to confusion.

33. how to use array in methods    forums.oracle.com

If there is something wrong with it, you should either get an error while compiling or during run time. If so, please post the error message as well. I can think of at several possible errors. 1. Function is not an interface but a class 2. Function is in another package 3. Function is an interface that declares other methods as ...

34. Problem with arrays    forums.oracle.com

35. Arrays    forums.oracle.com

36. problems initialising an array    forums.oracle.com

37. buttons and arrays    forums.oracle.com

Ok. So I changed to >. However, it still doesn't do what I want it to do. Right now if you click on Last, you do get the last element in the array, however, if you click on Next, you also get the last element in the array. I would presume that it would either fail since there are no more ...

38. Extending arrays    forums.oracle.com

Hi, Im now trying to solve another question, can you please help me out with it. Just please help me start it off, as in give me some tips that might help me solve it. I've searched ways in which i can extend arrays on the net but i really didnt find anything usefull. this is the question: Consider the following ...

39. Using arrays in JAVA    forums.oracle.com

Hi Guys, I always had a few problems using arrays and now I need to use them and I am stuck. on my program i need to create an array of int with the numbers 1 to 1000 in it for this I have done: int[ ] array; on the class constructor array = new int[1000]; to fill the array: for ...

40. Array question    forums.oracle.com

41. Array Comparision    forums.oracle.com

42. Methods and Arrays    forums.oracle.com

Thanks - I knew a method cannot return more than one value, and it can return an array, but needed some confirmation on the 2d array. Think i need to ingrain in my head the fact that an array is not more than one value. In your example you use i as your loop counter - is this standard practice as ...

43. ARRAYS    forums.oracle.com

How can I alter this program so that it reads the data from a file. The students name should appear on a line of the input file by itself and the test grades will appear one per line on successive lines. A blank line at the end of the file indicates the end of that students grades. Then output the results ...

44. array help needed    forums.oracle.com

how is that??, my problem is to keep dividing first number as long as it is modulos=0, like say 40 keep dividing 2, as long as modulos=0, 40/2, then 20/2, then 10/2, then 5/5, and collect 2,2,2,5, then stop it, without this recursive looping will jump to 40/2,then 40/4, 40/5... and so on, i couldnt figure out

45. Simple Array function    forums.oracle.com

46. how to accept input and store it on array    forums.oracle.com

47. array of buttons .. wut do u thik right?    forums.oracle.com

48. how to use array    forums.oracle.com

49. implementing an array    forums.oracle.com

50. Array of Arrays    forums.oracle.com

/*As the name referance variable stores the memory location for the string Similary the obect referance varible store the memory location of the array name city and weight. as object[0]=name this means they both refer to same memory location Can any one please tell my how i can easily access all the array through obect array. Something similar to this i ...

51. Please Help Me Correct My Code. (ARRAYS)    forums.oracle.com

I suggest you repost your code. Paste it into a reply, select it all, and then press the "code" button above the message composition box. As it is, the Forum formatter is eating your "i" array subscripts within brackets because they look to it like italic indicators, and the lack of indentation makes it harder to read. I did notice that ...

52. can u help me defining array    forums.oracle.com

1) an array is like a memory location that holds the reference to a collection of Objects of similar data types. 2) eg of passing an array of integers: passArray(int[] arrayName); ... .... ... public void passArray(int[] anArray) { } .. ... ... 3)Pls rephrase yr qns.. Do u mean the object that u create for that array? eg. int[] anArray ...

53. Array question!!!    forums.oracle.com

i suppose you can make a new array when your current one is full twice the sice of the first one then copy all the elements from the previouse array into this one and dereference all the elements in the first away so that the garbage collector can restore their memory spaces.

54. Newbie needs help!!! Array problem    forums.oracle.com

{ //creates array int[] scoreArray = new int[ARRAY_SIZE]; //variables int arrayLength; int largest; int smallest; double avg; //creates a new scanner and associates it with the input file Scanner testFile = new Scanner(new FileReader("c: scores.txt")); arrayLength = testFile.nextInt(); if (arrayLength <=ARRAY_SIZE) //populates the array from the text file fillArray(testFile,scoreArray,arrayLength); //finds highest score in array largest = highScore(scoreArray); //finds the average score ...

55. Returning arrays from methods    forums.oracle.com

Perhaps it'd be easier if I typed the guidelines I have to follow to explain this: Part1_a: Write a method called enterMarks() which creates a new array called classMarks, and prompts the user to enter 20 marks between 0 and 20, which will be entered into the array as they are read in. This method should include the print statement to ...

56. creating 3 arrays from a scan..    forums.oracle.com

57. Array Push??    forums.oracle.com

Think it is not array copy. Actually what I wish to do is.. Say if i have string array ={a,r,r,a}; then push y into the array or may be y and s in the array like this string array={a,r,r,a,y}; or string array={a,r,r,a,y,s}; If I can do something like that, I can keep expand the array value as needed.

59. array help    forums.oracle.com

I have this problem that I can't get right. Assume that an array of int s named a has been declared with 12 elements. The integer variable k holds a value between 0 and 6 . Assign 15 to the array element whose index is k . this is what I wrote. if (k >= 0; k<=6; k++) a[k] = 15; ...

60. array help    forums.oracle.com

You simply want to do this: smooth = A*signal for a vector 'signal' and a matrix A like this: [ 1/2 1/2 0 0 0 0 0 0 ........ 0 ] [ 1/3 1/3 1/3 0 0 0 0 0 ........ 0 ] [ 0 1/3 1/3 1/3 0 0 0 0 ........ 0 ] . . . . . . ...

61. Array help    forums.oracle.com

63. Help using arrays in java    forums.oracle.com

I am trying to write a program using a matrix. The size of the maxtrix should be 30X30. The first initial shoulld be initialized to '*' and the secind initial should be initialized to '@'. Both initials should be 30 characters high and 30 characters wide and the initials should also represent the uppercase letter of your initials. I know that ...

65. how to store things into array?    forums.oracle.com

the first string is my encrypton string..the lines after that are username, pword,username, pword etc. the problem is i need to use that third array ( the position stuff) to modify the pwords so it outputs differently from the above file pwords..can someone help me..thx..(if u need clarification, dont be afraid to ask)

66. help with array    forums.oracle.com

You have an array of characters. In a loop, you're calling println for each element of that array. Println prints what you give it as an arg, followed by a newline. If you just want the whole table array on one line, then you can use print instead of println, with a no-arg println() after the loop to get a newline ...

67. need help with arrays    forums.oracle.com

68. sum of array !! plz help    forums.oracle.com

69. array problem    forums.oracle.com

70. array help..    forums.oracle.com

The secret seems to be in taking the remainder of division by 25 or 26 and maniupulating it. What are your sample input values (character positions) versus desired output values (indexes into the array) - give more than just the one (28 to become 2 or 3 depending on how you view indexing the array). For example, if the input value ...

71. Duplicates in arrays    forums.oracle.com

Is humanPlayerLetters of type String[]? If so why? It seems that it should always contain a single character, if so, then char[] would probably be the more fitting choice. But that probably has nothing to do with your problem. If you really always want one instance of the letter replaced, you could probably simply put a "break;" after the assignment inside ...

72. Array Question ??    forums.oracle.com

I have to Design and write a class that accepts up to 20 grades (integer values) from a client or driver program. i have to also throw an exception if the program exceeds 20. i also need a method in the class that can be invoked to print all the grades from the array. can anyone help me ?? ill take ...

73. a little help on arrays    forums.oracle.com

B. Create a static method called diffArray() that takes two integer arrays a and b as arguments and returns a reference to array c containing the element-byelement difference of array a and array b (or a ? b). a) Test diffArray() method in your TestArray class with arrays x and y. b) Display the result. Please show your work to your ...

74. array problem    forums.oracle.com

I would geuss that the reason the call to the Vector classes toArray(0 method does not seem to be working is that you are not captruing the value that is returned. If you read the javadoc for the toArray() method it says that an arry is returned by the call, so you need to capture that in a variable.

75. Another array problem    forums.oracle.com

Hi again everyone, This problem--I have no idea how to set up this area--is a tough one!! The problem says: Write a program that reads a file consisting of students' test scores in the range 0-200. It should then determine the number of students having scores in each of the following ranges: 0-24, 25-49, 50-74, 75-99, 100-124, 125-149, 150-174, and 175-200. ...

76. Working with Arrays & Methods    forums.oracle.com

totalGrades; ^ K:\CalculateCurve.java:135: ')' expected ( ^ K:\CalculateCurve.java:160: illegal start of expression } ^ K:\CalculateCurve.java:170: ')' expected public static String getOutput(int totalGrades + int highGrade + ^ K:\CalculateCurve.java:193: ';' expected } ^ 9 errors Process completed. What am I doing wrong? I don't see where I missed any ';' or ')' or ']'.

77. Need some help with arrays and methods please    forums.oracle.com

78. Regarding to arrays    forums.oracle.com

79. Need help with an array    forums.oracle.com

81. A simple Array question    forums.oracle.com

Your rules are good. Since you don't know how many unique File objects, you probably want a resizable collection. A Set will work well, since you want uniqueness. Put each element of "files" into the Set (a HashSet will do). You can construct and populate the HashSet in one line using the appropriate HashSet constructor and your "files" array along with ...

82. Arrays    forums.oracle.com

This line: int [] array = new int [] {1,3,3}; should be written like this: int[] data = {1, 3, 3}; 1) You always want to name your variables with a descriptive name. 'array' fails miserably. 2) As shown, you can use an initializer list to initialize an array, and the array will automatically be the correct size. This line: int ...

83. arrays    forums.oracle.com

84. "swap" arrays    forums.oracle.com

I'm having some trouble. I need to have the program swap the first array with the last. char[] table = {'a', 'b', 'c', 'd'}; table.swap(a,d); Without the swap, it displays a, b, c, d and i can't figure out how to make the program swap the a and d so it will display d, b, c, a. The problem is in ...

85. Simple question about arrays!    forums.oracle.com

86. help with array (cont)    forums.oracle.com

87. help with array    forums.oracle.com

page, does your RandomIntList really have to be an array? It's just that you're having trouble re-inventing the square wheel... a Collection of somesort would be much easier, and therefore less bug-prone... probably a List... probably an ArrayList. List's have "factory-made" add & remove methods... and lots of other useful goodies like sort, shuffle, addAll, removeAll, etc etc etc. Keith.

88. Problem with bidim Array - increases to double why ? Anyone plz???    forums.oracle.com

jfbriere ....oki , but can i do that? one method just for the board that receive de size, and another method that receive the ( x , y ,letter ) and then call the board method and insert the letters ? Or do i have to do everything in the same method? O.o from your post it seems its possible lol ...

89. Smalles valua if not in array.    forums.oracle.com

when you exit the loop using 0 it wount be countet to average. Thats why I have "averege = sum / (kertoma-1) <--- lets say...if I put numbers, 5,6,7,8,9 I have 5 numbers so it would be sum/5, when I add the 0, I have 6 numbers but with -1 again I have sum/5

90. State of checkboxes in array    forums.oracle.com

91. Array Help    forums.oracle.com

You're getting that weird output because you're trying to print an array directly with System.out. When you call System.out on an object (and arrays are objects) it invokes the object's toString() method. Arrays' toString() method produces the output you're seeing. To change the output, you have a few options: 1) loop through the seats array, and print each value individually. 2) ...

92. Help with 3D array!    forums.oracle.com

Why must they be stored in a single 3d array? At least one error in your code is that you're dividing by zero. There's no need to put each value into its own little array. If you wanted to do that (I don't know why you would) you'd really have a 4-d array of tables.

93. Array addition    forums.oracle.com

I'm trying to keep track of a piece on a chess board. Using multidimensional arrays, how would I add them together? For example, my board size is a grid of [8] by [8]. i want to keep track of a knight which would move for example 2 down and 1 right. how would i add [2][1] if my starting position is ...

94. array?    forums.oracle.com

It's a little late for my fruit picking story but here it is. I am going to make a crate that can hold 100 apples. When it is finished does it automagically hold 100 apples? No, I then have to go and pick the apples and put them in the crate. Arrays work the same.

95. Cutting/Grabing part of an array    forums.oracle.com

I was wondering if there was a way to cut/grab part of an array Example: I want to grab/cut the elements from place[3][3] - place[8][8] I want to know if I can do this with out using a loop or recursive method, because the elements are going to be updating constantly and I only need certain methods to get certain parts ...

96. array!    forums.oracle.com

I would like to have oine array for simplicity. Basically seats one through 5 are first class and seats 6 through 10 are second. Can I label the first five elements (seats) as first class and do the same for the last 5 seats except make those economy. As far as the array itself is concerened, there's no way to specify ...

97. array    forums.oracle.com

I need to build an array representing an airline seating chart. the first 5 elements are first class and the last 5 elements are second class. How would I actually seperate the 2 without making 2 arrays? Something like: Create an interface that represents a seat. Create a class that extends the interface that is a first class seat. Create a ...

98. Arrays question    forums.oracle.com

99. help with array    forums.oracle.com

Consider making a, b, c, d, f private fields of your GradeGraph. You could have a total field as well. The constructor will set the value of these fields. The getPercentA() method will do the right thing to return the percentage of the class with A's etc. Note: like volume() in your other thread you don't need the two int arguments. ...

100. arrays...beginners    forums.oracle.com

when i try to compile it give me and error "Cannot find symbol JOptionPane. wheres i have declare it Look at your message, it is hardly readable. Whenever you post Java source code but [code] ... [/code] tags around it. There's even a button for just that above the text entry window. To be absolutely sure there's also a [Preview] button ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.