Tagged Questions
2
votes
4answers
79 views
How to make an array from array of objects
I have these objects of arrays with information stored in them which i have extracted from a file. How can change these into an array, i think i am meant to use 2D arrays, i want to sort them and ...
2
votes
1answer
44 views
Two threads for updating a game? one for graphics and one for game logic?
I was wondering if it is possible to make two threads, one of them to handle the graphics and drawing of the objects, and the other one to update position and logic.
Now the main problem I think ...
0
votes
3answers
53 views
Mapping unique points to unique integer index
I am not familiar with coordinate systems or much of the math dealing with these things at all. What I am trying to do is take a Point (x,y), and find its position in a 1 dimensional array such that ...
2
votes
4answers
40 views
Searching extracted data from a file, stored into an array for answers. IO
I have successfully extracted data from 2 files and stored them in array objects in their respective classes. This is some of my data that i have stored in array objects:
...
4
votes
5answers
58 views
unexpected increment result in java array
While learning how to declare, initialize and access the array elements in java, I wrote this simple code:
class ArrayAccess{
public static void main(String args[]){
int[] a;
a ...
0
votes
3answers
46 views
Input output, not all lines have same amount of data
i have been given a file full of details and have to extract it and store into different arrays of objects according to its respective column. The tricky thing is, not all lines have the same amount ...
-1
votes
1answer
75 views
Whats wrong with this java code? [closed]
I want to store a whole line from a txt file into an array i managed to do that but when it comes to searching from the array i can't seem to do that.Here's the code:
import java.io.*;
import ...
-3
votes
2answers
90 views
Convert Object[] to Array() [closed]
How to convert Object to array?
I have this code, but it is create new, clear Object
public Object[] toArray() {
return toArray(new Object[size()]);
}
-1
votes
2answers
24 views
Swing JList, to show only 15 records
I'm making some kind of control panel with a real time log.
Real time log supposed to show last 15 logins. If there are more than 15 records, then I want last record to be deleted and the on which ...
0
votes
2answers
33 views
input/output of an array of objects in Java and StringTokenizer
I have a problem however i'm not quite sure where it lies.
I am reading data from a text file, NRL team data to be specific. The data is split up with commas and the data is: club name, club mascot, ...
2
votes
3answers
32 views
Error: Constructor cannot be applied to given types
So I am writing a class for this rainfall assignment, I think I could get it working but I am having a problem with the final portion of the program "Rainfall rain = new Rainfall();".
I know that I ...
1
vote
1answer
48 views
Creating a flexible temporary game data storage system
I'm making a 2D physics game with Java and have recently decided to completely start over so that the program's foundations have flexibility and threading in mind since. My problem is finding a way to ...
0
votes
4answers
49 views
Java Scanner Read from File
Let me first establish the following fact: I am new to java, so please be patient.
In my programming class, we were given an exercise to do at home using the Scanner class. The activity shows the ...
11
votes
5answers
155 views
What is the motivation of retrieving the length of an array using a public instance variable, instead of calling a method? [duplicate]
Since most other classes seem to let the developer retrieve the length or size of its content by calling a method, usually length() or size(), how come the length of an array is retrieved by reading ...
-1
votes
1answer
59 views
Adding numbers from 1 array using condition from another array [duplicate]
int[] material = {6255,6255,5003};
int sumQuan = 0;
int []quantity = {6,5,1};
String []calc = {"1","1","0"};
int len = material.length;
int a = material[0];
for(int i = 0; i < len; i++)
{
...