FAQ: Learn Java: Manipulating Variables - Greater Than and Less Than

This community-built FAQ covers the “Greater Than and Less Than” exercise from the lesson “Learn Java: Manipulating Variables”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn Java

FAQs on the exercise Greater Than and Less Than

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I love codeacademy, but the variable names in the Learn Java course are absolutely atrocious. I’m getting carpal tunnel syndrome trying to type them.

3 Likes

i just popped my middle finger trying to wright graduate capital.

I agree :angry: some of these things are crazy.

Any reason as to why in this section in the statement “System.out.print()” the “ln” is left out is that okay? Or is this just a mistake by Codeacademy. Thanks :slight_smile:

Hello @muazilyas and welcome to the Codecademy Forums!

Both System.out.println() and System.out.print() are valid statements that take in arguments and display them to the console. System.out.println() outputs the argument to the console and moves the cursor to the next line. System.out.print() also outputs the argument to the console but simply moves the cursor to the end of the text, not the next line. This article might be helpful.

2 Likes

How this code automatically evaluate boolean value without boolean method.? can you explain?
image
link below for the lesson :point_down:

https://www.codecademy.com/courses/learn-java/lessons/learn-java-manipulating-variables/exercises/greater-than-and-less-than

< is a binary comparison operator and it compares whether val1 is less than val2. Comparison operators always return a boolean and thus the result of a comparison using these operators does not need to be converted to one.

1 Like

Thank you for the clarification. Appreciated

1 Like

I got confused on the first sentence:

  1. Create a variable called **creditsAfterSeminar** that holds the amount of credits earned after taking a seminar, which is worth creditsOfSeminar credits. creditsAfterSeminar should be the sum of creditsEarned and creditsOfSeminar .

Print out whether creditsToGraduate is less than creditsAfterSeminar .

With that instruction to declare it, is my code correct?

double creditsAfterSeminar = creditsOfSeminar;
double creditsAfterSeminar = creditsEarned + creditsOfSeminar;
System.out.println(creditsToGraduate < creditsAfterSeminar);

1 Like

Welcome to the forums!

This sentence explains that you should declare a variable named creditsAfterSeminar. Then, it explains that this variable should hold the number of credits the student has after the seminar. It then states that the seminar itself is worth creditsOfSeminar credits.

Perhaps it would be better rephrased like this.

Create a variable called creditsAfterSeminar that holds the amount of credits earned after taking a seminar. A seminar is worth creditsOfSeminar credits.

Knowing this, what changes should you make to your code?

2 Likes