Https://www.codecademy.com/en/courses/learn-java/lessons/introduction-to-java/exercises/variables


#1



Replace this line with your code.


#2

Ok so next time it would be preferable if you give your code and error along with the link to help us helpers out even more! For you see I can only explain the lesson but I can't give you help specifically based on your code! However, I haven't answered a java question in what seems like years so I will do it this once xD :sunglasses:

So lets work through the instructions step by step to get the desired code! And of course as you should know by now do each step individually not all together! All // indicate comments not real code.

1.) Set the int variable myNumber equal to the value 42.
So we take this instruction literally and should build just like it says

int myNumber = 42; //int first then variable third equal to finally 42;

2.) Set the boolean variable isFun equal to true.
Just like the last instruction we can take this very literally and build it just like the instructions say!

boolean isFun = true; //first boolean then variable third equal to finally true;

3.) Set the char variable movieRating equal to 'A'.
You know the drill by now! Think literal!

char movieRating = 'A'; // first char then variable third equal to finally A; with quotes around it

Sorry if the explanation is too childish I tend to explain stuff that way over the internet and I hope this helps! Cheers! :smiley:

Edit: "A semicolon ; is also used to end all Java single code statements. We will cover statements that should not end in a semicolon later in this course." quoted from lesson page on Codecademy. Basically don't forget the punctuation!


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.