Brand new, Beginner question


#1

Hello everyone, glad to be with these forums as I take a dive
into programming. I've done days of research glanced around a
bit at Python and have decided to take in Java as my first language.
So here is my question ..

I understand variables are used to store value.
So in the code below,

int myNumber = 42;
boolean tree = true;
char grass = 'G';

is 42, true, & A the values the variables are storing?
I also understand this question is most likely dumb
but i'm just trying to make sure i'm understanding it.
Thanks in advance

AddiTech89.


#2

Yes those are the values the variables declare are storing. Meaning that wherever we write myNumber it means 42. Likewise the other variables
if you were to write

System.out.println(myNumber); // we would see 42

#3

Hey thanks for that quick reply rydan.
Also thanks for re-assuring me what
I was talking about. So therefor, anytime
I used the variable names throughout the
script, would I just be referring to the value?


#4

Yes that's right. and if you change it along the way you will see the new value instead
for example
somewhere along your code you did

myNumber = 50;

calling myNumber will now be 50