The error is because you are trying to assign a double value to array in the following statement:

    mylist = bob.nextDouble();

as mylist is defined as an array here:

    double[] mylist;

First you need to intialize your array:

    double[] mylist = new double[2]; // initialise array to have two elements

and then try to assign the array elements with the user input like this:

    mylist[0] = bob.nextDouble();
    mylist[1] = bob.nextDouble();
Answer from Juned Ahsan on Stack Overflow
🌐
Huda Tutorials
hudatutorials.com › java › basics › java-arrays › java-double-array
Java double Array - double Array in Java
May 18, 2024 - A double array in Java is a one dimensional array or single dimensional array that stores elements of the double data type. Double precision floating-point numbers in Java conform to the IEEE 754 standard, providing a significant range and precision ...
🌐
TutorialsPoint
tutorialspoint.com › home › java/util › arrays.fill() method in java
Java Arrays fill(double[], double) Method
September 1, 2008 - The Java Arrays fill(double[] a, double val) method assigns the specified double value to each element of the specified array of doubles.
🌐
Codecademy
codecademy.com › learn › learn-java › modules › java-two-dimensional-arrays › cheatsheet
Learn Java: Two-Dimensional Arrays Cheatsheet | Codecademy
Setting arr[i][j] equal to a new value will modify the element in row i column j of the array arr. double[][] doubleValues = {{1.5, 2.6, 3.7}, {7.5, 6.4, 5.3}, {9.8, 8.7, 7.6}, {3.6, 5.7, 7.8}};
🌐
Know Program
knowprogram.com › java › double-array-java
Double Array in Java - Know Program
Know Program | Learn to Code for Free. Java Tutorial, Program, and Quiz, C Tutorial, Program, and Quiz. Learn Oracle database, JDBC.
🌐
GeeksforGeeks
geeksforgeeks.org › java › array-getdouble-method-in-java
Array getDouble() Method in Java - GeeksforGeeks
November 30, 2018 - The java.lang.reflect.Array.getDouble() is an inbuilt method of Array class in Java and is used to return the element present at the given index from the specified Array as Double.
🌐
Trinket
books.trinket.io › thinkjava › chapter8.html
Arrays | Think Java | Trinket
You can make an array of ints, doubles, or any other type, but all the values in an array must have the same type. To create an array, you have to declare a variable with an array type and then create the array itself. Array types look like other Java types, except they are followed by square ...
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › 2d-array-in-java-two-dimensional-and-nested-arrays
2D Array in Java – Two-Dimensional and Nested Arrays
August 10, 2022 - To create a two dimensional array in Java, you have to specify the data type of items to be stored in the array, followed by two square brackets and the name of the array.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-guava-doubles-toarray-method-with-examples
Java Guava | Doubles.toArray() method with Examples - GeeksforGeeks
July 11, 2025 - Below programs illustrate the use of toArray() method: Example 1 : ... // Java code to show implementation of // Guava's Doubles.toArray() method import com.google.common.primitives.Doubles; import java.util.Arrays; import java.util.List; class ...
🌐
DataCamp
datacamp.com › doc › java › double
double Keyword in Java: Usage & Examples
A for-each loop iterates through the array and prints each temperature. Precision: Use double when you need more precision than float can provide. The double data type is more precise but also consumes more memory (64 bits). Avoid Using for Exact Values: Avoid using double for exact values like currency.
🌐
Software Testing Help
softwaretestinghelp.com › home › java › array data types – int array, double array, array of strings etc.
Array Data Types - int Array, Double array, Array of Strings Etc.
April 1, 2025 - The above program defines an array with initial values and another array in which the values are assigned in a For Loop. An array having elements of type double is another numeric array. The example given below demonstrates the double array in Java.
🌐
Coderanch
coderanch.com › t › 712963 › java › printing-double-arraylist-double-arraylist
printing double arraylist of double arraylist (Java in General forum at Coderanch)
I'm guessing that you want to go from a 2D array to a 2D list, but it's not clear why. Additionally, you've declared 'value' as an int and I'm assuming 'x' is a double, so how are you getting doubles that have a fractional component? As a wild guess at your intent. Note that this does not swap rows and columns the way it seems that yours does. ... JavaRanch-FAQ HowToAskQuestionsOnJavaRanch UseCodeTags DontWriteLongLines ItDoesntWorkIsUseLess FormatCode JavaIndenter SSCCE API-17 JLS JavaLanguageSpecification MainIsAPain KeyboardUtility
🌐
Coderanch
coderanch.com › t › 484374 › java › Double-array-int-array
Double array to int array? [Solved] (Beginning Java forum at Coderanch)
Unfortunately System.arraycopy() won't help you here and neither will any of the utility methods provided by the java.util.Arrays class, so you'll have to do code the loop-convert-store routine yourself. Edit: Sloooooooow. Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life. ... Otherwise, the loop will start with element 1 of the array rather than element 0.
🌐
Software Testing Help
softwaretestinghelp.com › home › java › java double – tutorial with programming examples
Java Double - Tutorial With Programming Examples
April 1, 2025 - We have initialized two double variables and calculated the difference between their values. Again we have initialized two variables using Big-Decimal class with the same value and calculated their difference. Finally, we printed both the values and you can see the difference between them. The calculated value of Big Decimal was automatically rounded-off. import java.math.BigDecimal; public class example { public static void main(String[] args) { // Initialized two double numbers double length1 = 1.06; double breadth1 = 1.07; // Subtracting length and breadth double sub = breadth1-length1; Sys
🌐
DaniWeb
daniweb.com › programming › software-development › threads › 370643 › arraylist-double
java - ArrayList [SOLVED] | DaniWeb
creates an array of two doubles. your length is fixed, so, don't ever try to add a third element. a List on the other hand will automatically add room for more elements if you add one …
🌐
Java67
java67.com › 2014 › 10 › how-to-create-and-initialize-two-dimensional-array-java-example.html
How to declare and Initialize two dimensional Array in Java with Example | Java67
For example salutation[0][1] represents a Single String in Java, while salutation[0] represents a one-dimensional array ( a single row in the 2-dimensional array). You can further see Algorithms and Data Structures - Part 1 and 2 courses on Pluralsight to learn more about it. So far we have just declared and created the array, we haven't initialized them. This means all elements of the array have their default values e.g.
🌐
Reddit
reddit.com › r/learnprogramming › question: finding different number in double array (java)
r/learnprogramming on Reddit: Question: Finding different number in double array (Java)
August 5, 2020 -

Hi! I would appreciate some help with this exercise.
Prompt:
There is an array with some numbers. All numbers are equal except for one. Try to find it!

It’s guaranteed that array contains at least 3 numbers.

The tests contain some very huge arrays, so think about performance.

Example:
Kata.findUniq(new double[]{ 1, 1, 1, 2, 1, 1 }); // => 2

My Code:

public class Kata {
	public static double findUniq(double arr[])
	{
		for (int i = 0; i < arr.length; i++) {
			for (int k = i + 1; k < arr.length; k++) {
				if (arr[i] != arr[k]) {
					return i; 
				}
			}
		}
		else if
		{ return; }
	}
}

My Question:
How do i return the different double from the array? I know that only ints work for loops, so I'm not sure how to return a double for it.
Thank you