Skip to main content

All Questions

Tagged with
0 votes
2 answers
80 views

How do I Take 2D array with variable columns as input from user in Java?

I want to take a 2D array with each element as an input from user. However, I want the user to specify in each array(i.e the column part or the each individual array) how many elements are there i.e ...
Vidita Singh's user avatar
0 votes
0 answers
45 views

How to take input from user and store it in array until the user enters a specific word

I want to create a 2D array with the help of user input but the user do not specifies the length of the array. The input taken from the user should be saved in a 2D array. until the user inputs "...
Jay-23's user avatar
  • 1
0 votes
1 answer
737 views

How to resize the array in Java?

I have been trying to create my own Array class, which is dynamic, but I can't figure out the problem in resizing the size of it. I created separate function to check if the array is full and for ...
Nikhil Yadav's user avatar
-2 votes
1 answer
59 views

List Interface implementation

I have created in class a generic class that works like ArrayList. The class included an array that gets bigger and smaller by demand by functions. Now, I have to implement the List interface and got ...
Eviatar Zilberman's user avatar
-1 votes
1 answer
32 views

I'm trying to understand dynamic arrays, I'm stuck on line 7, this(16); Is reference to the size of the array?

I'm starting at Free Code Camps but I had never seen line 7-- this(16); I would appreciate if you told me what it does and where I can read more about it. public class DynamicArray<T> implements ...
Dami Devil's user avatar
0 votes
2 answers
670 views

Java - Add and remove elements from a dynamic array/list

I need my array to be dynamic, as long as the user enters/deletes elements. The array can't have the length already defined or ask the user the length. For example the user decides to add 5, the array ...
aksjdhad's user avatar
-3 votes
2 answers
113 views

Java double comparison while part of a data structure [duplicate]

I was messing around with data structures and while creating a Dynamic Array in Java from scratch, I figured out that my delete method (in the DynamicArray class) was not working for doubles. I've ...
Tasos Stefanidis's user avatar
0 votes
1 answer
84 views

Is it possible to give every spinner item a different color

In an alertdialog I have a spinner with color codes: Spinner cSpinner = (Spinner)mView.findViewById(R.id.spinner_c); ArrayAdapter<String> cadapter = new ArrayAdapter<String>(Cal_main.this, ...
user2378812's user avatar
0 votes
1 answer
54 views

No exception raised for referenced unassigned array element containing an object

MRP class B { static int v; public B(int i) { System.out.format("Constructor called with value %d\n", i); v=i; } } public class A { static B[] c; ...
mhaselup's user avatar
  • 238
-1 votes
1 answer
360 views

Only the last element of the array is displayed [closed]

Only the last element of the array is filled; when a new element is added to the array, the old element becomes null. public void SelectClick(View view) { ... materialCardView.setId(secondId); ...
Xelloeuy's user avatar
0 votes
2 answers
119 views

Question about "Unexpected type" for Dynamic Array

Good evening everyone, sorry for bothering. I have a problem while trying to configure the "DynamicArray" by myself. Here I made a sort method but the terminal shows "error:unexpected ...
Dave's user avatar
  • 3
4 votes
0 answers
62 views

Need help declaring and assigning multidimensional arrays with different numbers of elements in Python (v Java)

I am a long time java user diving into python. I am searching for a way to create multi-dim arrays that may not have the same number of elements, some or all are NOT known until run time. In java I'd ...
Tam's user avatar
  • 1,209
-1 votes
2 answers
698 views

How to store elements in Array during runtime without knowing array size during initialization in Java? You cannot use Arraylist

static int[] evenFactorsOfNum(int num) { int[] result = {}; // need help in this line int index = 0; for (int i = 2; i <= num / 2; i = i + 2) { if (i % 2 == 0) { ...
Nirmal Silwal's user avatar
0 votes
1 answer
45 views

How can I keep track of object lists that reference each other in java?

I'm writing a java application that has users that create contracts. The contracts have a list of supporting users that can be added to the contract. The user that created this contract is not on the ...
Bobby's user avatar
  • 3
-2 votes
3 answers
95 views

Using variables outside while loops in java

I'am trying to write a program in Java that collects users favorite names within an array and then prints these names at the end. NOTE: the length of the array should be defined by the number of names ...
M. Steiner's user avatar

15 30 50 per page
1
2 3 4 5 6