Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Team Constructor | Classes
Java Extended
course content

Kursinnhold

Java Extended

Java Extended

1. Deep Java Structure
2. Methods
3. String Advanced
4. Classes
5. Classes Advanced

book
Challenge: Team Constructor

Oppgave

Swipe to start coding

Here is a class called Team written for you. Your task is to write a constructor that takes all 4 parameters and initializes all 4 fields. Please do not modify the Main class and its methods.

  1. Write a constructor with 4 parameters: name, sport, yearFounded, and city.
  2. Initialize the name field with the value of the name parameter.
  3. Initialize the sport field with the value of the sport parameter.
  4. Initialize the yearFounded field with the value of the yearFounded parameter.
  5. Initialize the city field with the value of the city parameter.

Løsning

java

solution

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 4. Kapittel 7
toggle bottom row

book
Challenge: Team Constructor

Oppgave

Swipe to start coding

Here is a class called Team written for you. Your task is to write a constructor that takes all 4 parameters and initializes all 4 fields. Please do not modify the Main class and its methods.

  1. Write a constructor with 4 parameters: name, sport, yearFounded, and city.
  2. Initialize the name field with the value of the name parameter.
  3. Initialize the sport field with the value of the sport parameter.
  4. Initialize the yearFounded field with the value of the yearFounded parameter.
  5. Initialize the city field with the value of the city parameter.

Løsning

java

solution

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 4. Kapittel 7
Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Vi beklager at noe gikk galt. Hva skjedde?
some-alt