In 3126, everyone knows about System.out.println() and uses it often. It's not just CodeGym students that begin to learn programming with this command. Even children do. Let's write a program that displays my friend's true birth year. He was born 8 years ago.
My young friend
- 2
Locked
Comments (85)
- Popular
- New
- Old
You must be signed in to leave a comment
ชัยพล คุ้มศิริ
27 June 2025, 16:47
int a = 3126;
int b = 8;
System.out.print(a-b);
0
Don Ricket
15 January 2024, 11:21
public static void main(String[] args) {
int year = 3126;
int age = 8;
System.out.println(year - age);
}
}
0
Daedalus Owner / Founder at BDI technologies
19 August 2023, 01:48
Easy two-line code:
+4
AndyFrancisqo
8 August 2023, 21:58
int currentYear = 3126;
int friendAge = 8;
int birthYear = currentYear - friendAge;
System.out.println("My friend's birth year is " + birthYear);
+1
Naif Al-Jaaidi (Nafmee)
16 July 2023, 01:39
int currentYear = 3126;
String birthYear = "My friend's birth year is " + (currentYear - 8);
System.out.println(birthYear);
0
zam
23 May 2023, 03:16
public class Solution {
public static void main(String[] args) {
int year = 3126;
int ago = 8;
System.out.println(year - ago);
}
}
+2
Abrar Mirje
5 May 2023, 05:54
int currentDays = 3126;
int age = currentDays - 8;
System.out.println(age);
0
PRIYANKA DEWARE
13 April 2023, 17:03
int a = 3126;
int b = a - 8 ;
System.out.println("my friends birth year.");
System.out.println(b);
0
Nomophobic Girl
11 March 2023, 16:12
And the answer is...
System.out.print("my friends birth year");
System.out.println(3118);
0
Daedalus Owner / Founder at BDI technologies
19 August 2023, 01:50
While technically correct, it defeats the purpose of the given variables of the current year and age of the friend. Try to do the math through the code and output the result! :-)
0
hidden #11284516
13 February 2023, 11:17
int year=3126;
int age=8;
System.out.println(year-age);
0