Skip to main content

All Questions

Tagged with
0 votes
2 answers
52 views

Logic of for loop using with array to access elements of the array in java

My code to access elements of array using for loop. The output of the program is [19,17,15] which are the elements of array int a[] = { 12, 15, 16, 17, 19, 23 }. Output after following code is written:...
AKSHAT MISHRA's user avatar
-1 votes
2 answers
332 views

How do I debug arrays? [closed]

I have this assignment that I am having trouble on. I'm supposed to fix syntax error in the code to produce the desired number. I fixed the amount of arrays from 4 to 3 and added "[]" to the ...
louis-129's user avatar
0 votes
2 answers
78 views

debug problem in the checking, old wizards cult riddle

I'm trying to solve this riddle in java, about an old man who lives because his cult who gives the old man some of their life, this specific code should work to the rules which are given but one of ...
Gil Caplan's user avatar
0 votes
2 answers
75 views

Compiler not recognizing that class string value is equal to another String value [duplicate]

public class Station { String name; boolean pass; int distance; // method to create a new Station taking the arguments of the name,pass and distance in the parameter public static ...
GigaHiga's user avatar
0 votes
2 answers
60 views

Array rotate with juggling algorithm fails

This question is from G4G array rotation. I am getting an error in the second loop telling me the array is getting out of scope. But I don't understand why. import java.util.Scanner; public class ...
vighnesh's user avatar
2 votes
1 answer
186 views

How can i fill one cell of array in java (android Studio)

I write this but all cells fill together. how can I fix it. Integer [] history=new Integer[5]; for (int i=0;i<history.length;i++) { history[i]=Jamkon.intValue(); } txt_H.setText(...
rasoul fetrati's user avatar
3 votes
1 answer
377 views

Getting random verbiage while printing array variable in Java

I'm learning basics of Java and there seems to be an observation I'm not able to get my head around. Below is the code that is supposed to print the binary implementation of a base10 number. There ...
shuberman's user avatar
  • 1,490
-1 votes
1 answer
3k views

What does the error Index out of bounds for length mean in Java? [duplicate]

I have encountered the same error many times, and I don't know why it happened or what caused it. I tried literally changing everything but it either only allows me to type 2 numbers or just gives me ...
Harry Peng's user avatar
1 vote
1 answer
1k views

Eclipse displays red values for a Java byte array when debugging

I am currently working on a software that makes a serial communication with a hand-made simulator using the RXTX library. To test the limits of my software, I set distinct COM parameters between my 2 ...
0009laH's user avatar
  • 1,998
-1 votes
1 answer
45 views

Why does my program for enumerating the prime factors of a list of numbers return unexpected values?

Given a list of integers from a minimum to a maximum, I am trying to find the list of prime factors that evenly multiply into any of the integers in the previously given list. For example, given as ...
Jodast's user avatar
  • 1,289
0 votes
2 answers
125 views

I am storing the the modified arraylist in map every iteration, then why map contains only the last modified list?

import java.util.*; import java.lang.*; import java.io.*; /*In this question i am modifying the array in every step and adding them to hashmap. ...
vicky's user avatar
  • 31
-1 votes
3 answers
45 views

How do I correctly add a variable to a array?

I am trying to assign a variable to an array but I keep getting ArrayIndexOutOfBounds error and I am stumped on why it doesn't work. THE QUESTION: Write a program that reads an arbitrary number ...
Trying101's user avatar
0 votes
1 answer
258 views

Why is this line printing twice?

So I help tutor an Algebra 2 class at my local high school, and the class is currently looking over matrices. Though not there, they will eventually get to multiplication of matrices. After taking ...
CurlyCue's user avatar
0 votes
4 answers
66 views

Having problems when comparing two arrays

The program is supposed to translate a word from American to British version. It only works for the first word but it doesn't work for the other words because it gives the else statement instead. My ...
Maky 's user avatar
-1 votes
1 answer
34 views

I have an array that has 10 values, however somewhere along my code one of the values changes?

I'm currently debugging the code using the eclipse IDE and trying to figure out where this change takes place. Is there anyway I can set my debugger to expect an array of certain values and then show ...
S.Doyle's user avatar
  • 213

15 30 50 per page