1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ololo11 [35]
4 years ago
13

Provide Java code to illustrate how to create an array, reference an array, and address an element of an array.

Computers and Technology
1 answer:
tia_tia [17]4 years ago
4 0

Answer:

Hi!

<u>To create an array:</u>

type[] varname OR type varname[]

where:

  • type is the class of the array.
  • var-name is the name of the variable.
  • [] indicates that the instance would be an array.

Examples:

float floatArray[];

boolean[] booleanArray;

String[] stringArray;

Object objectArray[];

<u>To reference an array:</u>

type varname1[];

type varname2[] = varname1;

where:

  • After assign varname1 to varname2, varname2 points to the elements of varname1;

<u>To address an element in an array</u>:

type varname[n];

type i = varname[i];

If you want to access to the i element of the array you can do : varname[i];

You might be interested in
Im building my first gaming pc, got any part suggestions or tips?
ladessa [460]

Answer:

You should find a good game engine that is not hard. Unity and Unreal are some good ones.

You should also search for the programming language you like the most, and use engines that use that specific language.

5 0
3 years ago
Read 2 more answers
NO SPAMMERS, ONLY FULL ANSWER
melisa1 [442]

Answer:

true

Explanation:

4 0
3 years ago
Read 2 more answers
Write a program that has a while loop to print out the first five multiples of 15, 43, and 273 between the numbers of 3168 and 3
Reika [66]

Answer:

#include <iostream>

using namespace std;

void printmultiples(int n) //function to print first five multiples between 3168 and 376020

{

   int a =3168,c=1;

   cout<<"First five multiples of "<<n<<" are : ";

   while(a%n!=0 && a<=376020) //finding first mutiple of n after 3168.

   {

       a++;

   }

   while(c<6)//printing multiples.

   {

       cout<<a<<" ";

       a+=n;

       c++;

   }

   cout<<endl;

}

int main() {

   int t,n;

   cin>>t;//How many times you want to check.

   while(t--)

   {

       cin>>n;

       printmultiples(n);//function call..

   }

return 0;

}

Input:-

3

15

43

273

Output:-

First five multiples of 15 are : 3180 3195 3210 3225 3240  

First five multiples of 43 are : 3182 3225 3268 3311 3354  

First five multiples of 273 are : 3276 3549 3822 4095 4368

Explanation:

I have used a function to find the first five multiples of the of the numbers.The program can find the first five multiples of any integer between 3168 and 376020.In the function I have used while loop.First while loop is to find the first multiple of the integer n passed as an argument in the function.Then the next loop prints the first five multiples by just adding n to the first multiple.

In the main function t is for the number of times you want to print the multiples.In our case it is 3 Then input the integers whose multiples you want to find.

7 0
4 years ago
You're programming an infinite loop. What must you include in your code to prevent crashes?
natta225 [31]

You have to put repeat

4 0
3 years ago
Read 2 more answers
The process of ensuring that web pages coded with new or advanced techniques still are usable in browsers that do not offer supp
grigory [225]

Answer:

progressive enhancement

Explanation:

Progressive enhancement is a powerful method for web developers when building websites accessible to different level user-agents.

Progressive enhancement technique allows you start with <em>simple</em> and <em>foundational</em> layers and then building more complex technologies on top of it. This principle lets multiple level user-agents can access and retrieve your work no matter what level of technologies they are using.

8 0
3 years ago
Other questions:
  • Write a function "hailstone"that takes an int "n2"and prints the hailstone sequence. Hailstone Numbers:This sequence takes the n
    15·1 answer
  • You have been tasked with finding the routers that have been installed between two networks. what utility would you use to provi
    5·1 answer
  • Which of the following rules should be used to keep the appropriate distance between your vehicle and the vehicle in front of yo
    10·2 answers
  • What is the relationship between IaaS and TCP/IP and network services?
    10·2 answers
  • As the internet continues to expand and become vital to everyday life, it may become more regulated with rules just like our eve
    6·2 answers
  • Which is an example of correct HTML? &lt;h1&gt; This is a heading&lt;/h1&gt;
    9·2 answers
  • Can somebody tell me the Minecraft command to clear an entire world and destroy every block if u Dunno please don’t answer &gt;-
    13·1 answer
  • What is the best wi-fi name you have ever seen?
    10·1 answer
  • Which programming scenario would most likely involve this array block?<br><br>SOMEONE PLEASE HELPPP​
    9·1 answer
  • Legends are titles given to three-axis X, Y, and Z-axis. True or false?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!