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
Firdavs [7]
3 years ago
12

I have to write this in Java, but i've never even learned it before and i'm completely lost

Computers and Technology
1 answer:
Varvara68 [4.7K]3 years ago
7 0

Answer:

private void printArray(int[] arr){   //0

  System.out.print("[");   //1

  for(int k : arr){   //2

     System.out.print(k + ", ");   //3

  }

  System.out.println("]");   //4

}

Explanation:

This method should get you started. Your teacher may want a different format or a different type of loop. If you haven't learned for loops yet don't use them that'd be suspicious ;)

What I did:

0: This is the method heading with one parameter for the 1D array. If you need to access it in a different class change private to public.

1: This prints the [ with no line break

2: This is an enhanced for loop to iterate through each element in a 1D array. Alternatively, a normal for loop looks like this:

for (int i = 0; i < arr.length; i++)

instead of retrieving the variable with the enhanced for, you'd have to use arr[i] instead of k in this scenario.

3: This prints the value in each pass of the loop along with a comma and a space.

4: This adds the ] with a line break when the loop is completed

Hope this helps you get started :D comment if you need further help

You might be interested in
What is the answer ????​
zzz [600]

Answer:

august po

Explanation:

pabrainliest ty

5 0
2 years ago
A user is claiming a host can be reached via the IP address but not through the name. What should a technician do first to resol
bagirrra123 [75]

Answer:

Add an entry to the HOSTS file

Explanation:

A file that is used to add the host name along with their IP addresses is called Host file. In this file all the IP addresses are mapped with their respective host names. Whenever some user tries to access some website, he may use the name of website to access it. The website have both name and IP address of the server, both of these information stored in host file. On GUI the user only see the information of Host name.

If some user only access the IP address of the website instead of the host name. The technician should add the name and IP address of the host in Host file. He should follow the following steps to resolve the problem.

  1. Access the host file by following the given path of file in Windows operating system.
  2. open the host file
  3. edit the file with new host name and relevant IP address
  4. save the changes

3 0
3 years ago
sharon gives a thumbs-up to her little brother who has just scored in his schools basketball game. sharon is communicating by us
stellarik [79]
She is communicating by using a gesture...
Please mark as brainliest...
6 0
3 years ago
Read 2 more answers
5 differences between a regular mouse and a gaming mouse​
alexdok [17]

Answer:

A gaming mouse has more buttons to keybind to while a regular mouse is simpler

Explanation:

6 0
2 years ago
The point at coordinates (2, -18) is in what direction from the origin?
laila [671]
On a graph, move 2 spaces to the right and from there move 18 spaces down. Now, where you've ended, make a dot. The distance fro the origin is -2/18 (as a fraction).
4 0
3 years ago
Other questions:
  • Which one of these students is having a positive impact?
    8·2 answers
  • Which kind of software allows users to draw pictures, shapes, and other graphical images with various on-screen tools such as a
    14·1 answer
  • What do you call an unsolicited email message that masquerades as coming from a legitimate sender, and attempts to get you to di
    11·1 answer
  • This diagram shows a number of computing devices connected to the Internet with each line representing a direct connection.
    11·1 answer
  • Why is the cyber community important???
    8·2 answers
  • Ile 1 cm<br> ?<br> 50 m<br> The an
    5·2 answers
  • Paul has been working long hours. He is tired and distracted by family issues,
    10·1 answer
  • Which statement best compares routers and hubs?
    9·1 answer
  • 9. Which of the following is considered an interface? (1 point)
    11·1 answer
  • What technology does kroger’s edge technology and amazon’s just walk out technology leverage?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!