answersLogoWhite

0


Best Answer

Button[] buttons;

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

AnswerBot

6mo ago

To declare an array of buttons in Java, you would use the following syntax:

Button[] buttonArray = new Button[n];

where n is the number of buttons you want in the array. This creates an array of n buttons, where each element can hold a reference to a Button object.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you declare an array of buttons in Java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you declare an array of 8 floats?

In C float a[8]; In Java float a[] = new float[8];


How do you initialize an array variable in java program?

An array in java is a collection of items stored into a single unit. The array has some number of slots (elements), each slot in the array can hold an object or a primitive value. Arrays in java are objects that can be treated just like other objects in the languageArrays can contain any type of element value , but we can't store different types in a single array. We can have an array of integers or an array of strings or an array of arrays.To create an array in java ,use three steps1. Declare a variable to hold the array2. Create a new array object and assign it to the array variable3. Store things in that array


How many dimensions you can declare in array?

It seems that the number of allowed array dimensions is implementation specific and not set by the Java specifications. I'm sure that any Java implementation will allow a reasonable number of dimensions for any project you have. After a quick test, it seems that Java is not limited by an arbitrary number so much as a practical value. If you add hundreds of array dimensions, Java will allow you to do so as long as you have enough memory allocated for Java. After a bit of copy-pasting the program no longer ran, exiting with a StackOverflowError.


You can use a variable to declare an array's size true or false?

True and false in the same time, because even so you can declare array size using notation for variables you have use constwhich makes your variable basically a constant:const int arraySize = 10;In Java, you can use any expression to define the array size, when you create the array. Once you create an Array object, however, you can't redimension it - but you can create a new Array object and destroy the old one.


Create an array of 10 elements in java?

to create a new Java array use typeName[] arrayName = new typeName[10]; This gives an array with 10 elements. To set the elements you can use arrayName[index] = value; Remember that the index number starts at 0, so the array will only go to index 9. You can also declare the contents when the array is created typeName[] arrayName = {value1, vaue2, ...} The values used in the array must be objects. In java 5+ you can use primitive types with no concern due to auto-boxing.

Related questions

How do you declare an array of 8 floats?

In C float a[8]; In Java float a[] = new float[8];


What are benefits of array in java?

array example in java


How do you initialize an array variable in java program?

An array in java is a collection of items stored into a single unit. The array has some number of slots (elements), each slot in the array can hold an object or a primitive value. Arrays in java are objects that can be treated just like other objects in the languageArrays can contain any type of element value , but we can't store different types in a single array. We can have an array of integers or an array of strings or an array of arrays.To create an array in java ,use three steps1. Declare a variable to hold the array2. Create a new array object and assign it to the array variable3. Store things in that array


How many dimensions you can declare in array?

It seems that the number of allowed array dimensions is implementation specific and not set by the Java specifications. I'm sure that any Java implementation will allow a reasonable number of dimensions for any project you have. After a quick test, it seems that Java is not limited by an arbitrary number so much as a practical value. If you add hundreds of array dimensions, Java will allow you to do so as long as you have enough memory allocated for Java. After a bit of copy-pasting the program no longer ran, exiting with a StackOverflowError.


You can use a variable to declare an array's size true or false?

True and false in the same time, because even so you can declare array size using notation for variables you have use constwhich makes your variable basically a constant:const int arraySize = 10;In Java, you can use any expression to define the array size, when you create the array. Once you create an Array object, however, you can't redimension it - but you can create a new Array object and destroy the old one.


How do you write the program to search for a word in an array of 5 words?

Write a loop that compares the word with every word in the array. For example, in Java, I think it would be something like this: // Declare some variables here ... for (int i = 0; i


Prog to display array element?

Java solutionFortunately, Java has a number of useful functions in the java.util.Arrays class for us.A call to...System.out.println(java.util.Arrays.toString(array));...will print out any array.


How does one initialize a byte array in Java?

One can get information about how to initialize a byte array in java on the website stackoverflow dot com. That website can learn one a lot about java.


Create an array of 10 elements in java?

to create a new Java array use typeName[] arrayName = new typeName[10]; This gives an array with 10 elements. To set the elements you can use arrayName[index] = value; Remember that the index number starts at 0, so the array will only go to index 9. You can also declare the contents when the array is created typeName[] arrayName = {value1, vaue2, ...} The values used in the array must be objects. In java 5+ you can use primitive types with no concern due to auto-boxing.


How do you swap rows in 2 dimensional array in Java?

[]temp = array[1] array[2]=array[1] array[1]=[]temp


How do you declare an array in easytrieve?

your wish


Can Array List in java hold different data types?

No, we cant hold different data types in an Array. But using Array List we can hold any data type as a Object. But you need iterate that values as a Object and again you need to convert those values into the different data types accordingly.