<You can use the questions listed here: About the Stories & Projects category to help write your story.>
Hey! I just started in here .. am kinda confused can someone please help me with variables! ... it's java lesson 5 I think ...variables... thnk U
Without code, a link to the lesson, or an error message, there’s not a ton we can do to help you
However, a bit of advice for variables in java:
so simply writing
x = 12 you have to specify
x as a data type capable of handling numbers, such as an integer, or a float
int x = 12 will make the x variable equal to a 32-bit signed integer
there are other data types such as
- Bool: A boolean value that is either true or false
Float A single-precision 32-bit IEEE 754 floating point (it can handle decimals, basically)
There are other data types, which you can find more information about here
Sorry my English is kinda bad!
The problem is this
int myNumber; boolean isFun; char movieRating;
I don’t know What to right
I’m new so I don’t know a lot
Can u help me
When you’re creating a variable, you can choose to assign it a value:
for example, when you type
int myNumber = 4, it creates a variable called myNumber which can then be used multiple times later on in your code.
you have to use the
= sign to actually give your variable a value though, otherwise it’s just null
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.