Challenge: Profile Card
Completed
Create these variables inside main:
String name="Asha"int age=21double 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
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
You can practice without logging in. Log in to save completion.
Save your progress
You're practising as a guest, so your progress won't be saved.
- Track every lab you complete
- Earn verifiable lab certificates
- See your progress in every module