Challenge: Profile Card

Lab Java Beginner 10 points

Create these variables inside main:

  • String name = "Asha"
  • int age = 21
  • double height = 1.62

Then print a profile card:

Name: Asha
Age: 21
Height: 1.62 m

Input

None.

Output

The three lines above.

Example

Output

Name: Asha
Age: 21
Height: 1.62 m
Sample output available
Editor
Java

Hints

Join text and a variable with +.

Don't forget the space after each colon.

Solution explanation

Each println joins a label and a variable with +.

Show solution
public class Main {
    public static void main(String[] args) {
        String name = "Asha";
        int age = 21;
        double height = 1.62;
        System.out.println("Name: " + name);
        System.out.println("Age: " + age);
        System.out.println("Height: " + height + " m");
    }
}
Output
Answer
HOME LABS COMMUNITY DASHBOARD