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

Kursusindhold

Java Extended

Java Extended

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

book
Challenge: Updating User Information

Opgave

Swipe to start coding

Your task is to update the fields of the existing person object using setters and getters. Change the name to Bob and set the age to 27.

  1. Implement the getName() and getAge() methods, as well as the setName() and setAge() methods with the appropriate parameters and types.

  2. Update the name and age using the setName() and setAge() methods.

  3. Print the object with the updated fields to the console.

Løsning

java

solution

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 5. Kapitel 6
toggle bottom row

book
Challenge: Updating User Information

Opgave

Swipe to start coding

Your task is to update the fields of the existing person object using setters and getters. Change the name to Bob and set the age to 27.

  1. Implement the getName() and getAge() methods, as well as the setName() and setAge() methods with the appropriate parameters and types.

  2. Update the name and age using the setName() and setAge() methods.

  3. Print the object with the updated fields to the console.

Løsning

java

solution

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 5. Kapitel 6
Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Vi beklager, at noget gik galt. Hvad skete der?
some-alt