5
votes
3answers
169 views

How to store and check synonym of string in Java

I'm making a program which can response to what user said, something like chatter bot. But I wonder if I can make it understand if two or more words have the same meaning. For example, I make it to ...
6
votes
4answers
119 views

casting Object[] to a reference type array in java

In implementation of a generic stack ,the following idiom is used and works without any problem public class GenericStack<Item> { private int N; private Item[] data; public ...
13
votes
5answers
1k views

use of array of zero length

for example we can construct such an array like this: new elementType[0]; I seen such a construct, but I don't understand why this might be useful
-1
votes
4answers
47 views

How do I remove an element from an array in Java? And how do I skip null array elements?

I'm working through a class assignment and I'm not sure how to remove an element from an array. I've read suggestions to use ArrayUtils or convert the array to a linked list. I'm still very new to ...
0
votes
2answers
59 views

How to create objects from a text file? [closed]

I have a text file of information that I want to make into Objects. The text file looks like this: mediterraneanAvenue 60 0 50 {2, 10, 30, 90, 250} 0 balticAvenue 60 0 50 {4, 20, 60, 180, 450} 0 ...
1
vote
3answers
60 views

String Split null value in to array to use if statement

Here's the scenario. User enters 3 types of inputs: 1/1/2013 12:00:00 AM_5/31/2013 12:00:00 AM 1/1/2013 12:00:00 AM_ _5/31/2013 12:00:00 AM The input is for date range query. 1st input: Split by ...
2
votes
3answers
55 views

How to turn an ArrayList with Object[]'s into an Object[][] array? [duplicate]

I have an ArrayList with Object[]'s and I need to convert the ArrayList into an Object[][] array in order to put the data in a JTable. How can I do this? I have tried: (Object[][]) ...
3
votes
3answers
4k views

Array seems to be getting passed by reference in Java, how is this possible?

I can post more code if I need to, but before that I would like to just ask a general question about the following method in which an array is passed, and then set to another array, but for some ...
0
votes
2answers
55 views

Array Clone doesn't work

what is wrong with my code? in the main method i am doing this: int [] test=new int[48]; test=etable(Right[]).clone(); What i want is, that the 'test' array is exactly the same like the output ...
0
votes
2answers
71 views

How do i save a value from an object array in java?

I'm a starting programmer and i can't seem to find my mistake in my code. I have an arraylist of objects(persons) and I want to save the value of an index into a variable: public void ...
0
votes
1answer
36 views

accessing a method in an array of objects that are in an array of objects

How do I access an array of objects inside of an array of objects? my code: private boolean intersect(Polygon[] polygons, Line[] the_path, int i, int j) { int k = 0; boolean intersect; ...
0
votes
2answers
50 views

Array-array index by value

I have the following variables: byte[][] bytes; byte[] value; Is there a smart way to find the index of the first matching entry of value in bytes ? value is NOT the same object as an entry in ...
0
votes
2answers
41 views

Can't cast methods from a cloned array

I am trying to cast methods from a cloned array. However, I'm experiencing some issues. Here's the code: Array1[] a = new Array1[] { "new Array1("exampletext", 0.5, 205) }; ...
5
votes
4answers
64 views

Java Finalizers, what tasks are really necessary

ArrayList<Object> foo; Object[] bar; typical finalizers will do foo = null; bar = null; My question, will ArrayList call a finalizer wich sets any pointers it holds to null, or do I have to ...
-7
votes
0answers
29 views

having NPE in this section, does anyone knows why it hapens, and what exactly NPE is [closed]

having NPE in this section, does anyone knows why it hapens, and what exactly NPE is /** * this method returns the number of actual trips the company have * * @param - no parameter is given to ...

1 2 3 4 5 477
15 30 50 per page