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
How does critical thinking relates to peer assessment?
Dovator [93]

Answer:

Peer review is a critical component of the life of the mind and an effective teaching strategy for nurturing students' critical thinking skills. ... peer review of writing is most effective when students have an opportunity to revise their writings prior to submitting a grade. Is it true that peer assessment helps students develop their critical thinking skills?

The students' perceptions of the peer evaluation activity were later elicited in interviews and a short written survey. The findings of the study indicate that peer evaluation activities did help in developing critical thinking skills, thus improving their academic writing performance.

Explanation:

8 0
2 years ago
Which is an appropriate strategy for using a workplace blog?
OLEGan [10]

Answer:

a

Explanation:

8 0
3 years ago
Alfons recently received a promotion to lead a team of 35 software engineers, testers, and business analysts. When he needs to s
muminat

Answer:

C) Selective Authentication

Because users that only he allows to read the email can, in this case his team members.

3 0
2 years ago
James’s work computer has lost its Internet connection but is otherwise working. If James’s colleagues have lost their Internet
Alja [10]
A. Server is down somewhere
5 0
2 years ago
Suppose that we have an implicit-free list allocator for which header and footer blocks are eight bytes each. To reduce overhead
Sergio039 [100]

Answer:

16 bytes is minimum size of any block.

Explanation:

The minimum block size is 16 bytes. 4 additional bytes added for a header and blocks are allocated in multiples of 8 bytes.

3 0
3 years ago
Other questions:
  • Use the single-server drive-up bank teller operation referred to in Problems 1 and 2 to determine the following operating charac
    10·1 answer
  • What types of storage can be used to access data from another computer
    8·2 answers
  • Which type of text may be formatted to print at the bottom of every page?
    6·1 answer
  • This LEGENDARY character made a much-celebrated comeback in 2017. What was the name of the villain he faced in this epic tale?
    7·2 answers
  • Do you think boot-camp-style treatment centers can help young. People kick smartphones addictions?
    14·2 answers
  • In 1-2 pages, identify a social networking technology and identify at least 10 security and/or privacy risks the technology has
    8·1 answer
  • If you're under 18 and you receive _____ or more license points in 12 months, you'll be restricted to driving only to school or
    11·1 answer
  • 5.4.6: Rolling Dice code
    12·1 answer
  • Write a program that will generate a personalized invitation within a text file for each guest in the guest list file using the
    15·1 answer
  • Which of the following is NOT an example of soft skill?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!