CodeGym
Promotion
CodeGym University
Learning
Course
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme
Question
  • Reviews
  • About us
Start
Start learning
Start learning now
  • All questions
kunal yerunkar
Level 0
Mumbai
  • 08.04.2019
  • 1000views
  • 3comments

only one requirement are pending ?

Question about the task My young friend
Java Syntax,  Level 0,  Lesson 4
Resolved


It's currently 3126. My friend was born 8 years ago.
Write a program that displays my friend's birth year.

Requirements:
  • The program should output text.
  • The displayed year must consist of 4 digits.
  • The displayed year should begin with "31".
  • The displayed year must match the task conditions.
package com.codegym.task.task01.task0103; /* My young friend */ public class Solution { public static void main(String[] args) { int a=31,b=8; String s="It's currently "+a+"26. My friend was born "+b+" years ago."; String e= "Write a program that displays my friend's birth year."; System.out.println(s); System.out.println(e); } }
0
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Aditya Shrivastava
Level 3 , Teni, India
11 April 2019, 13:48
make it simple and easy, no? it's just saying to subtract 8 years from current year, that's it! don't think too complex it is just level started. ;-)
0
Solomon Egwuonwu
Level 13 , Post Falls, United States
10 April 2019, 15:35
All you have to do is declare two integer values int a = 3126; int b = 8; the subtract b from a and display the result.
0
Guadalupe Gagnon
Level 37 , Tampa, United States
8 April 2019, 19:45solution
Your program is only supposed to output one thing, the number that equals 3126 - 8. Anything that is not that result will automatically fail verification. The output from your program is: It's currently 3126. My friend was born 8 years ago. <---- auto fail Write a program that displays my friend's birth year. <---- auto fail Correct output: 3118
+4
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Game Projects
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning and Java developer’s career.
Follow us
Interface language
Programmers Are Made, Not Born © 2023 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2023 CodeGym
This website uses cookies to provide you with personalized service. By using this website, you agree to our use of cookies. If you require more details, please read our Terms and Policy.