array 5 « 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 5 

1. array woes    coderanch.com

I am trying to do a 2 dimensional array where size, beginning number and end number are passed in through the parameter. I keep getting an illegal start erro on the first dimension when I try to compile. I left the 2nd dimension as simple integers for now because if I can get the first half working, I can get the ...

2. incompatible type problem for array    coderanch.com

hi everyone, im currently very frustrated with this same problem that i can crack so any help is greatly appreciated. i currently have an array of arrays, a 2D array of distances. from this i want to take one of the rows of data from it and store it in another array to perform operations on it. So far my code ...

3. Arrays    coderanch.com

You can declare an array variable with no size: String[] tokens; Now that doesn't point to anything at all yet. But we can make it point to any sized array we like tokens = arrayOfFive; tokens = arrayOfTen; All the tokens variable knows is that it points to an array. The actual array we point to has a size and occupies ...

4. minimum edge and arrays    coderanch.com

hi all, im working on an algorithmic problem. At the moment i have a sorted array of integers some of which are zero. The integers are in fact weights. What i want to do now is to select the minimum integer (greater than 0) and return it whilst entering all the remaining ints in the array to anew seperate array. public ...

5. incrementally adding to array    coderanch.com

hi everyone, im currently working on minimal spanning tree style program. Im having a small but significant problem. Whenever my program selects a minimum edge, i add this edge to an array so that it cant be chosen again, however when i loop through on the second iteration, the program replaces this with the new minimum edge and so next time ...

6. Empty array    coderanch.com

7. arrays    coderanch.com

What is the wrong in the code? when I run this code, I am not getting any value import java.util.*; public class arraylist { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub arraylist a = new arraylist(); a.getFruits(); } String[] getFruits() { // Allocate space for the array and set all elements to ...

8. Array doesn't work    coderanch.com

9. ArrayIndex in Arrays    coderanch.com

Hello JavaProgrammers, None of the questions that were posed earlier could find solutions in java,that has now resulted me to get a tendancy to switch over to C++,though this is not an easy endeavour either.So as a final resort to get the real motivation for the continued grip for Java,let me get the correct procedure for array index being out of ...

10. array problem    coderanch.com

11. check Input array null or empty    coderanch.com

If the input parameter is null or empty, what should we do to handle it? like the following code to get the min number from array , Shoud it return error code, or throw excpetion? or should it be handled before the arr is passed in function? Also what is the normal way to set for the intial value for min ...

12. n-dimensioned array in Java    coderanch.com

How, in general, does one write a Vector of Vectors in Java - along with the more general Vector of Vectors of Vectors .... Sounds recursive, that may be the correct approach. Note - I realize this can easily hog resources and should be corralled to some extent. In general and simplified terminology, I am working on combinatorics which will work ...

13. twodim arrays    coderanch.com

I have a problem with this logic I am getting NumberFormat exception while doing TotAmt. Also suppose if i need to handle the empty array how would i handle it. Could please any one help me in the below case String [][] list = new String[3][3]; list[0][0] = "7.00"; for empty string list[0][0]=""; list[0][1]= "56.00"; list[0][2]= "eeeee"; list[1][0]="8.00"; list[1][1]="66.00"; list[2][2]="nnnnn"; float ...

14. Arrays In Question    coderanch.com

I tried but would like to know with the below declaration does array count spaces too? final int SEL_TERMTRANPRTLID_MAP[] = { 13 }; in what situation can array be declared of the above form ? As I came across a project wherein the above declaration exists for which i'm not able to proceed.

15. Clarification on Array!    coderanch.com

A. What's the difference between the following (except packages) and their usage: 1. Array 2. Arrays 3. [] (primitive or object type array) B. Can we interchange the usage of methods among these Array declarations and in what all ways? For Example: 1. Object [] myObjects; (assume with valid data) 2. Arrays.sort(myObjects); Note: Line 1 denoted general array type [] and ...

16. Create an Array of Weeks    coderanch.com

Can someone help me create an array of 52 weeks(three elements) with each week ending on Sunday and the first week will start on the following Sunday form current date. Element 1 = First date of week, Element 2 Last Date of week, and Element 3 a string of Last Date of week such as "5/18".

17. Problem on Arrays    coderanch.com

Write a method that creates and initializes a two-dimensional array of double. The size of the array is determined by the arguments of the method, and the initialization values are a range determined by beginning and ending values that are also arguments of the method. Create a second method that will print the array generated by the first method. In main() ...

18. Array initilisation    coderanch.com

In the following code compiler gives the error while assigning value to arr[2] class A { int[] arr = new int[5]; arr[2] = 10; //compiler gives error at this line } However if array is initialised inside a method then no error occurs. like class A { void meth() { int[] arr = new int[5]; arr[2] = 10; // perfectly ok. ...

19. Arrays    coderanch.com

In the following code - public static void main { int[] i = {1,2,3,4,5}; char[] c = {'a', 'b', 'c', 'd', 'e'}; System.out.println(i); System.out.println(c); } when it is run the output is - [I@73d6a5 abcde Why is the program outputting a reference to the int array handle but in case of a char array, it is printing the elements of the ...

20. Arrays    coderanch.com

Hello, Once an array has been declared it could not be resized. You would need to create a new array and move the values over. I'd use pseudo code such as; 1) Determine the length of the current array (n = array.length) 2) Create a new array of length n + 2 (int[] newArray = new int[array.length];. 3) For i = ...

21. arrays    coderanch.com

class a{ public static void main(String args[]){ int a[][]= new [2][]; System.out.println(a[0][0]); }} First of all, I'm assuming that you're statement declaring the array was meant to be int a[][] = new int [2][]; When I run this code, I get a null pointer exception, the reason being that a 2-dimensional array is an array of arrays. What you've declared so ...

22. about array    coderanch.com

Cindy, You snuck your reply in while I was writing mine. And it confuses me. She's using a long ... where do fractions come into it? Forgive me if I've got it muddled ... I'm veddy much a begineer. - joe [This message has been edited by Joe Von (edited March 02, 2001).]

23. Question about working with arrays    coderanch.com

24. simple array assignment question    coderanch.com

class f{ static public void main(String arg[]){ int a[]={0,1,2,3,4}; int A = 1; a[A] = a[++A]= a[++A]; System.out.println( a[0] ); // prints 0 System.out.println( a[1] ); // prints 3 System.out.println( a[2] ); // prints 3 System.out.println( a[3] ); // prints 3 System.out.println( a[4] ); // prints 4 } } I expected it to print 0,2,2,2,4 since going left to right the ...

25. Pleas help with array    coderanch.com

I am working on an assignment that is to make a heap from an array. One thing I must do is if an item is already in the array it is not to be added again, but the value only to be incremented. I have had limited success in that I can get it to increment but the word is also ...

26. How to return an array!    coderanch.com

27. Return type as array    coderanch.com

28. How to grow an array!    coderanch.com

public class GrowArray { private static int[] addToEnd( int[] theArray, int newNum ) { int[] newArray = new int[ theArray.length + 1 ]; for( int i = 0; i < theArray.length; i++ ) { newArray[ i ] = theArray[ i ]; } newArray[ theArray.length ] = newNum; return( newArray ); } public static void main( String[] args ) { int[] theArray ...

29. How to kill or destroy an array?    coderanch.com

That should do it.... You can just have the reference point to something else, if you want to reuse the reference. Since you set it to null, it means the array object/contents is available for GC. OTOH, you can just loop through the array initializing it's contents to any appropriate values you want. Bosun

30. Concatenate arrays    coderanch.com

Hmm... I have looked for a answer to this question for a few weeks now, thought I would try JavaRanch. How do you concatenate arrays? Say I have this int[] a1 = { 1,2,3,4,5}; int[] a2 = {2,4,6}; int[] a3 = {1,2,3,4,5,6}; int[] a4 = {4,8,12,1100}; How do I merge all of these array into one array? I know with a ...

31. Native arrays versus java.util.Array    coderanch.com

32. trying to avoid using an array...    coderanch.com

I'm fairly new to Java, just messin around tryin to figure out what I can and can't do. What I am tryin to do is get the same output as the TestTheory class (below), but I wanna drop the "theVar" variable and reffer to the "myInt#" variable using the i from the for loop. Something like: for (int i =1; i ...

33. arrays    coderanch.com

The processRecord method returns a String array // Record.java import java.io.*; import javax.swing.*; import java.util.StringTokenizer; public class Record { String[] inString_array; String in = new String(); public String readInputRecord() { String s = new String(); try { UI.pointer = ((int)((float)UI.input.getFilePointer() / (float)(UI.input.length()) * 100.0)); if((s=UI.input.readLine()) == null ) s += "END"; } catch(IOException e) { JOptionPane.showMessageDialog(null,"Error reading input file","Error",JOptionPane.ERROR_MESSAGE); ...

34. Arrays of arrays.......    coderanch.com

35. (re)assigning arrays?    coderanch.com

I have a question about (re)assigning array reference variables. If I create two arrays, I can reassign the reference variable name of one of them to the other array. No problem... I am curious, though, if I can ever reassign the reference variable to the original array, or if it is possible to assign a new reference variable to the now ...

36. Multidim. array garbage collection    coderanch.com

I have a question about multi-dimensional arrays... In Java, an array of more than one dimension is merely an array referencing more arrays... or a list of arrays. And in Java, arrays are instantiated as objects, not mere data structures. So the statement: int list[][] = new int[3][4] is really instantiating 5 objects? If so, that is really interesting... and it ...

37. Array Definition Question    coderanch.com

I am going through the book "A Programmer's Guide to Java Certification" and I came across the following code in the review questions. According to the question, the following two array definitions are valid : int []a[] = new int [4][4]; and int []a[] = new int [4][]; My question is this: What actually is created by each of these two ...

38. arrays?    coderanch.com

Are you asking how to find the largest number in the array or how to find the largest array index (aka the size of the array)? Mindy's post answered the size of array question. If you want to find the largest value in the array try something like this: int largest = 0 ; for( int i=0; i < ArrayVar.largest; i++) ...

39. More arrays    coderanch.com

Hello everybody. Can anyone please explain this. Mockexam question: Which of the following are legal array declaration. Select all correct answers. A. int[5][]; // Correct B. int[][]; // Not correct C. int[]i[]; // Why is this correct? D. int[5][5]; // Correct E. int[][]a; // not correct I'm just wondering why the "C" option is correct! I have a question for the ...

40. What about arrays?    coderanch.com

Howdy! I have some problems with arrays.... ( still? ). Consider the following code 1. int i[5][]; 2. int i[][]; 3. int []i[]; 4. int i[5][5]; 5. int[][] a; My notes: 1 is illegal because the array must be initialized: int i[][] = new int[5][] 2. Perfectly legal. 3. Here's my problem. Is this array one or two dimentional. Can anyone ...

41. Linear Arrays - Stacks    coderanch.com

42. Sparse Array Detection    coderanch.com

Supposed I'm to process an array of class A. And I want to process it differently if its sparse or not sparse. ("Sparse" meaning some items are null) Is there something in the reflection API or normal java.lang that will tell me whether an array is sparse or not ? P/S I'd rather not have to write my own routine to ...

43. Instances of an Array    coderanch.com

44. illegal start of expression -- arrays    coderanch.com

The problem is that your foo method requires an int array and that is not what you are passing it. Arrays in java are objects, so you need to create one to send. It looks to me like neither invocation will work. All objects, except Strings, need to be explicitly created with the new keyword. public class IllegalStartOfExpression{ public static void ...

45. arrays    coderanch.com

public class number { public int[][] array2D = { { 1, 2, 3 ,4 , 5}, { 6, 7, 8, 9, 10}, { 11, 12, 13, 14, 15}, { 16, 17, 18, 19, 20} }; { int a= Console.readInt("add a number"); array2D[0][0]=a; int b= Console.readInt("add a number"); array2D[0][1]=b; int c= Console.readInt("add a number"); array2D[0][2]=c; int d= Console.readInt("add a number"); array2D[0][3]=d; int ...

46. array    coderanch.com

Depends on what you mean by array. You can look in the API at Array, or ArrayList, or whatever and get a good understanding of classes of Arrays http://java.sun.com/products/jdk/1.2/docs/api/index.html If you are meaning an array of objects or simple values, it's just really a collection of similar things, and each item in the collection is designated by an index, with the ...

47. Union of two arrays without using a temporary array?    coderanch.com

Union of two ArrayLists without using a temporary array? do anybody have source code for this please let me know. or any suggetsiions how it can be done? i have two Arraylist objetcs and i need to do a union of it in the first arraylist itself which would contain elements fron the first and second arraylist together withour repetition ------------------ ...

48. initalizing arrays    coderanch.com

Hi, I'm declaring a "String[] keywords;" at the start of my program. Now I don't actually place anything into the array until I'm inside a couple for loops. When I compile, I get this error, "Variable keywords may not have been initialized." What do I do to fix this error. TIA. kevin

49. array?    coderanch.com

Here's an example of an array... //create our array String [] names = new String[3]; //assign the values to our array names[0] = "Mary"; names[1] = "David"; names[2] = "Greg"; for (int i=0; i < names.length(); i++) { System.out.println(names[i]); } names[2] = "Allan"; Okay, now for the explanation. First off, we declare a variable called names of the datatype String. With ...

50. array    coderanch.com

How do I make An array if I want to make an instance of a class, in other words class BB{ private int n; public calculations(); } \\\\\\\\Here is the main driver How can I set up an array of 25 b classes, would it be BB bk[]=new BB[25] How would I beable to access each method from the main: bk[i].calculations(); ...

51. Arrays    coderanch.com

52. arrays    coderanch.com

Kevin, i understood 3 things from your query: 1. Rather u want to trim spaces in strings elements of an array 2 : or u have eneterd just spaces and want to edit it. 3. there are spaces in between the string that u want to remove. for 1. u have to run a loop and trim every elemetnt with String.trim() ...

53. Multiple Arrays    coderanch.com

54. totaling array rows and columns    coderanch.com

------------------------------------------------------------ I can total my whole array. but now I am trying to do a total for the rows and an total for the columns. I am stuck on how I need to manipulate the code to just print by row and column seperate. -------------------------------------------------------------- int rowTotal = 0; int colTotal =0 ; for(int row = 0; row < sales.length; row++){ ...

55. Array problem    coderanch.com

Hey whats up everyone? I'm trying to create a program that loads an array of 6 numbers via random numbers, then compares those numbers with another 6 for a possible match ala (lotto). my problem is, I'm trying to figure out how to output a message if 6 of 6 numbers are the same, 5 of 6, 4 of 6, etc. ...

56. Increasing sizr of an array    coderanch.com

Anthony, 1. Go into a for or while loop 2. while in the loop, parse each character in the string 3. create a ListArray 4. as you parse the string, put each character into the List Array 5. As you put each character into the array, compare to each character already stored in the array (hint: nested loops) 6. When you ...

57. asking about arrays    coderanch.com

hi there, i have got some problem in a array programme given below: write a programme to create a rectangular array containing a multiplication table from 1*1 up to 12*12 Output the table as 13 columns with the numeric value right aligned in columns.(the first line of the output will be the column headings.the first column with no headings then the ...

58. Is this doable thru an Array java?    coderanch.com

Not sure how to store this info.... in java... String Array[i]; -----------can hold humans1-10 String Array[i][j]; -----------i can hold humans1-10(i row) -----------j can hold gender M or F(j coloumn) lets say: I have a list of 10 humans, for each human I want to hold name, gender, eye color, names and age of kids(a human can have more then one kid. ...

59. Array problem    coderanch.com

And if you're not ready to explore Vectors or other Collections classes... As Rob was saying, once created, an array's size cannot be changed. You can create a new array object of a different size, copy selected members from the original array into the new array, and then drop the reference to the original array and use your reference variable to ...

60. array assignment within the FOR statement    coderanch.com

hi, public static void main(String args[]) { int [] nArray = new int[11]; int i; for (i = 0; i < 10; nArray[i++] = i) { System.out.println(i + ":" + nArray[i]); } } The code above has following output: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 8:0 9:0 However, if the code is changed to this: (print out the result ...

61. FileIO and mult. arrays    coderanch.com

62. Array Tutorials    coderanch.com

63. "empty" array declarations    coderanch.com

Hello, I am curious about what's probably a design consideration made when designing the Java language. When considering these possible attempts at array declarations: int[] numbers1 = new int[0]; // compiles int[] numbers2 = new int[]; // won't compile int[][] numbers3 = new int[0][]; // compiles int[][] numbers4 = new int[][]; // won't compile int[][] numbers5 = new int[][0]; // won't ...

64. Arrays    coderanch.com

65. Randomizing an array    coderanch.com

I'm not sure if this is a question better situated for the applet board, however this section seems to get more action. I've created an array of objects that draws bars of varying heights. for (int i = 0; i < sortsBar.length; i++){ sortsBar[i] = new Bar (x, y, width, height); } sortsBar[0].addBar(1, 250, 5, 5); for (int i = 1; ...

66. Stupid question about initializing arrays    coderanch.com

Hi. well i woudlnt do it the second way.. just doesnt sem that professional tome but i may be wrong. If you really want to intialize it why not like you said just do it at the first line when you define th e variable too. like: int[] numbers={4,5,6,7} what diffrence does it make if you put it in the constructor ...

67. arrays    coderanch.com

68. Array Question    coderanch.com

Hi All, Consider the following String array declarations. 1) String[] paramString = new String[4]; paramString[0] = "user1"; paramString[1] = "pwd"; paramString[2] = "1"; paramString[3] = "sa"; 2) String[] paramString = new String[4] {"user1", "pwd", "1", "sa"}; 3) String[] paramString = {"user1", "pwd", "1", "sa"}; My assumption is that all of three are same Is there is any advantage or disadvantage in ...

69. populating an array via the user    coderanch.com

here is the code I have so far. import javax.swing.*; import java.io.*; import java.awt.*; public class Matrix1 { public static void main (String args[]) { int nums[][] ={{2,3,8,4},{0,-2,4,6},{-1,0,3,2},{2,1,4,9}}; String output1 = "From top left corner diagonally down to bottom right corner"; String output2 = "From bottom left corner diagonally up to top right corner"; String answer; int results,calc,display1,display2; results = nums.length; ...

70. Question about two dimesion arrays    coderanch.com

Hi, I'm studying for the Programmer cerification and I was trying to work with a two dimension array. Normally when I work with arrays, I use array.length to see the size of the array. That works great with a single dimension array. I was wondering if there is a way to do something similar to get the rows and columns from ...

71. counting items in an array    coderanch.com

Hello, i am working on a method that counts the items contained in an array. the array is of type boolean, named occupied. what i have : public int count() { int sum = 0; for (int i=0; i

72. Marcus Green Exercise on Array Manipulation    coderanch.com

Hi! The output of this is: bicycle apple pear plum BUT I shouldn't have initialised Fruit the way I do in "amethod", should have used the index and initialised each element individually.I just decided to try it. I guess the initialisation means that the array becomes a 4 element array now cos Java doesn't assign memory until then? Does using the ...

73. :confused: merge/covert array Part II :confused:    coderanch.com

I need to take all of the data in a double subscripted array, except for the first column, and add it into a new single subscripted array. I HAVE to do it by code, I cannot simply retype the data into the new array. I created the following as a test case and it works except for the fact that it ...

74. Arrays    coderanch.com

75. Problem returning array from accessor method    coderanch.com

I can't seem to get this "get" method to return a value. If place the return() statement in the try block, after conn.close() I get the error " missing return statement" if i place the return statement just before the outer closing brace I get cannot reslove symbol. Can someone spot my error? public Object[][] getMenuItems() { try{ //JOptionPane.showMessageDialog(null, "Loading menu ...

76. Create an array    coderanch.com

77. arrays    coderanch.com

What I am trying to do is to have a method that receives two arguments. The first one is an index for grades and the second one argument is the grade to be placed in the index. I am setting the grade into grades array and setting an equivalent gp. The gp is set by using a parallel array to find ...

78. accepting user input into into an array    coderanch.com

i'm doing this program for my java class that will sort a list of grades in descending order for a class of students. I have the logic and everything ready to go but am having troubles with one thing. How in the World do I put the input the user enters into an array? 1st - Program Asks for the number ...

79. Array documentation    coderanch.com

80. concatenate some arrays    coderanch.com

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - ...

81. Simple questions on arrays    coderanch.com

Answer 1 : the array is a primitive data type Answer 2 : It depends what do you want to do. If you have a lot of insertion to do the List object may be a good idea, the insertion is simple. On the other hand, insertion in an array is a little bit more complicated, you have to manage yourself ...

82. Array question    coderanch.com

Let's say I want to input (10) values into an array, and have them averaged, ok. Should I read each number in separately and them set those numbers to an array address? And is there an '.average' method? How can I make this quick and easy to follow (mostly for myself). Thanks in advance.

83. How to draw with two-Dimension array.. ??    coderanch.com

Originally posted by A.Rahman Yusuf: There is a qeustion that says : Intialize a 2 dimention array to the following values { {1,10,10,130,180}, {1,40,40,20,20}, {1,90,40,20,20}, {2,50,140,50,10} } { {3,60,110,90,110}, {3,75,80,90,110}, {3,75,80,60,110} } The First elemnt of each group represents the following 1- Oval 2- Rectangle 3- Line This doesn't make any sense to me. How exactly are the Oval, Rectangle, and ...

84. creating array at run time    coderanch.com

Well since you can't write a single function that can be passed either a double or an int, it's kind of a nonsense question, no? What you can do is pass a Class to a function to tell it what class to deal with. For the primitive types, Java declares Class instances such as Integer.TYPE, Double.TYPE, and so on (not to ...

85. How to create a color array?    coderanch.com

Question: I am trying to declare and assign values to a color array using sRGB values in one line. I have found that Color[] c1 = {Color.RED,Color.WHITE,Color.BLUE}; works. But how do I get Color[] c2 = {(255,0,0),(255,255,255),(0,0,255)}; to work? Currently I have Color[] c3 = new Color[3]; ... c3[0] = new Color(255,0,0); c3[1] = new Color(255,255,255); c3[2] = new Color(0,0,255); but, ...

86. a simple array question...    coderanch.com

It's quite some overkill, but not using (visible) loops can be done as follows: String[] arr1= { ... }; List list= Arrays.asList(arr1); List temp= Arrays.asList( new Object[] { null }); Object[] arr2= list.removeAll(temp).toArray(); The trouble is, you'll end up with an Object[], not a String[]. I think a simple (explicit) loop would be way more efficient. kind regards

87. arrays    coderanch.com

88. I'm lost on how to do and call 3d array    coderanch.com

Hi I am in a real mess, trying to do a 3d array. I am only new to java so forgive me If this looks messy.I do not know how to call the methods ect. what i have to sort out is! if i enter a airport name it will display the flight No's: if i enter flight number it will ...

89. Can anyone talk me through 3d array    coderanch.com

Hi, if my question is not allowed,please forgive me,I don't want to offend any one. I need to do a 3d array, I have tried but always get stuck! I want to learn java so I am not asking for the code. What i would like if some one to talk me through it step by step, by e-mail. I will ...

90. which of these 2 arrays is right    coderanch.com

Hi to every one, sorry I keep coming back but you seem like a good bunch out their.I need to do a 3imensional array.But I am new to programming, with no cow hands here to help me. As you will see its a array of airports ect but each airport could have upto 5 flights a day. So i need to ...

91. Arrays    coderanch.com

/* * MultiDimArrayCount.java * * Created on February 13, 2003, 4:30 PM */ package junk; public class MultiDimArrayCount { public static void main(String[] args) { int[][] a = new int[8][10]; int b = 0; System.out.println("Length of a: " + a.length); for (int i=0; i

92. Storing a count in a || array    coderanch.com

I'm working on a program that reads from a text file, parses each word and sorts them into an Array Based List. In addition I need a parallel array to keep track of how many times a word appears in the text file. So if a word appears more then once, it only goes into the SortedArrayBasedList once and its count ...

93. Java arrays basics    coderanch.com

Originally posted by Candy Bortniker: Ok, I was reading through here to see if I could offer advice or more likely learn something, then I got confused. I thought that arrays could be only int or float, etc. I just learned about vectors, similar to arrays but they hold objects such as strings. Am I misunderstanding something?

94. Question about Arrays    coderanch.com

I just read the topic a few down about arrays, they confuse me some what. I have nums as a reference for my array of a byte value. I then want to know how many negative numbers are within my array reference by nums display my results in the form of "nn negative numbers". Ok I understand that i can use ...

95. single arrays in java    coderanch.com

I can figured out what i do wrong. I try to write simple program that inputs 20 numbers from user and display them in fange from 10 to 100, only if not duplicated. import java.io.* ; import java.text.* ; class ReadNumbers { int luckyNums[] ; // array (unallocated) of numbers // constructor ReadNumbers( int nPick ) { luckyNums = new int[ ...

96. Help with an array situation    coderanch.com

I want to develop a menu-driven program to maintain information about a group of students using three coordinated arrays. The first array will hold student names, the second their majors, and the third their credits earned. The data for a particular student will be stored at the same index location within each array. Ok here what I have started code wise ...

97. need help with array program    coderanch.com

98. storing an array in a meathod problem...    coderanch.com

Hello everyone, I'm having a little difficulty trying to get a String to store a value to a StringBuffer. I'm thinking that I need to transfer the StringBuffer named major to major.toString however I need to assign it to a specific element named index. The error I am recieving is "Not an Expression Statement at Line 82." public class App { ...

99. Multi-deminsional Arrays    coderanch.com

100. Array?    coderanch.com

Nope. Once you instantiate an array the VM allocates space for it and there is no way to make it grow. You can create a temporary larger array, copy the contents of the old array into it and then set the old reference to the new array. Like this: int[] intArray = new int[30]; /* Fill our intArray with some interesting ...

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.