Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Autoboxing in Collections | Type Conversion and Wrapper Classes
Java Data Types

bookChallenge: Autoboxing in Collections

Oppgave

Swipe to start coding

Implement a method that calculates and returns the average value of all elements in the provided ArrayList as a double.

  • Complete the method so it uses a loop to sum all values in the input list.
  • Calculate the average as a double and return it from the method.
  • In the main method, call your method and print the result using this template: Average value: {average}.

Løsning

solution.java

solution.java

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 5
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

close

Awesome!

Completion rate improved to 7.14

bookChallenge: Autoboxing in Collections

Sveip for å vise menyen

Oppgave

Swipe to start coding

Implement a method that calculates and returns the average value of all elements in the provided ArrayList as a double.

  • Complete the method so it uses a loop to sum all values in the input list.
  • Calculate the average as a double and return it from the method.
  • In the main method, call your method and print the result using this template: Average value: {average}.

Løsning

solution.java

solution.java

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 5
single

single

some-alt