Well, I am attempting to read a text file that looks like this:
FTFFFTTFFTFT
3054 FTFFFTTFFTFT
4674 FTFTFFTTTFTF
... etc
And when I am reading it, everything compiles and works wonderfully, putting everything into arrays like ... |
class ArrayApp{
public static void main(final String[] args){
long[] arr; // reference to array
...
|
i cant figure out how to start a method to delete a specific entry stored in an array...
i used to do this:
public void deleteEntry() {
...
|
java:
import java.util.*;
public class WordPairs
{
// ArrayList<String> names = new ArrayList<String>();
// ArrayList<String> meanings = new ArrayList<String>();
...
|
I need to delete a character from a character array and re-size the array. Until now, I have worked on replacing a particular character with a special character.
In this code i ... |
@rookTheCook Arrays can not be shortened so what would you do with the duplicate elements that are supposedly removed from the array? Turn them into null values? Better turn your array ... |
hi, i'm trying to delete an item from an array by setting target item to null, and push all other items forward to take up the empty space. when i try to add something into the array, it gives me a NullPointer exception error. for (int i=0; i |
|
First, the direct answer: you have two choices. You can either set the element you're deleting to null; this is OK if your program is written to allow null items in the array. Otherwise, if the order of the elements matters, you have to copy all the elements starting with the next higher numbered one down by one, then set the ... |
In my program i've got an array of string, 10 elements long, when an element is removed i want it completely removed, so that when i print out the arrays contents i dont get one particular value coming up as 'null' but it is rather non existant and the other values respond to this so say i delete value 3, i ... |
Depends what you mean by "delete". You can't change the size of an array after creation. So you could * Shift all the following elements down one spot, and decrement a counter that keeps track of how many elements are in use. * Set the element you want to delete to some value that is not a valid "real" value in ... |
I am a student at SLU, and I am working on an assignment that calls for rows to be deleted out of arrays. Say for instance that I know the indices of the row I wish to delete. How would I go about writing code to do this? I am trying to delete rows out of a 2D array. Here's how ... |
i havent learned how to you use that.. i have only learned the basics of java. is there an easy way to ask the user to put in a letter and then remove it from an array of the full alphabet ex: abcdefghijklmnopqrstuvwxyz is printed.. the user types in 'b'.. the array then turns to acdefghijk..... i need it to just ... |
|
Okay so my assignment was to delete a double from an array, and then reduce the size of the array so it makes sense. So I did a toList and made the array a list, deleted the element I needed to delete, made a new array that holds this new information, and I'm almost there! I have been trying to copy ... |
|
Hey everyone, I have a quick question - I've been working on a program which creates a random letter array, and then sorts it, and then deletes the duplicates, while moving the rest of the letters to the left to fill the empty space in the array. I think I've got the deleteRepeats part down, but I've been struggling while working ... |
well actaully, i have a probelm that is why i am insisting in using 3 different array.. i am not supposed to use java.util.. or any other except java.io.*; so is it possible yes or no? i just wanted to noe the logic as i tried for 1 array and i worked.... but tring for 2 and 3 cannot process many ... |
thanks for that.. but the scary part is that i don't know how to use it, casue i have not learnt java.util, as the only package that i have learnt is java.io.*; sorry that i cannot use ArrayList, but thanks for the info.. well do you have a program where ArrayList is used, so that i can learn how it is ... |
I am a student at SLU, and I am working on an assignment that calls for rows to be deleted out of arrays. Say for instance that I know the indices of the row I wish to delete. How would I go about writing code to do this? I am trying to delete rows out of a 2D array. Here's how ... |