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
Nirake_
Level 8
Mumbai
  • 14.05.2020
  • 569views
  • 4comments

Cant understand it??

Question about the task Square of a number
Java Syntax,  Level 1,  Lesson 8
Under discussion

Write a program that displays the square of 5 on the screen.

Requirements:
  • The program should output text.
  • The main method should call the sqr method with 5 as an argument.
  • The main method should display the result of the sqr method.
  • Don't change the sqr method.
  • The displayed text must match the task conditions.
package com.codegym.task.task01.task0127; /* Square of a number */ public class Solution { public static void main(String[] args) { //write your code here System.out.println(sqr(5)); } public static int sqr(int a) { int b = a*a; return b; } }
0
Comments (4)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
hidden #10628226
Level 4
4 June 2020, 22:21
All you need to do is write the code where it says. Leave the main metho alone and declare the variable a with a number :)
0
Brandon
Level 9 , Toledo, United States
14 May 2020, 22:29
"Don't change the sqr method." Just reset it, and this time don't change anything within the "public static int sqr(int a)" method.
+3
Myko
Level 6 , Dresden, Germany
9 November 2020, 11:24
Hi Brandon! I cann´t find it out how can I reset the task or initial code to try it again?
+1
Rica
Level 3 , Manchester, United States
4 March 2021, 02:03
Hi! How do you go about resetting it?
0
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.