Creating and filling variables is a powerful concept that allows us to keep track of all kinds of data in our program.

In this lesson, we learned how to create and print several different data types in Java, which you’ll use as you create bigger and more complex programs.

We covered:

  • int, which stores whole numbers.
  • double, which stores bigger whole numbers and decimal numbers.
  • boolean, which stores true and false.
  • char, which stores single characters using single quotes.
  • String, which stores multiple characters using double quotes.
  • Static typing, which is one of the safety features of Java.
  • Variable naming conventions.

Practice declaring variables and assigning values to make sure you have a solid foundation for learning more complicated and exciting Java concepts!



The file MyProfile.java contains a class that represents your hiring profile as presented to potential employers.

In the main() method, create a variable called name that holds your name, as a sequence of characters.


Create a variable called age that holds your age as a whole number.


Create a variable called desiredSalary that holds your desired salary per year to a precision of two decimal points.


Create a variable called gender that holds a single character, m (male), f (female), n (for none), or o (for other).


Create a variable called lookingForJob that holds whether or not you are currently open to job offers.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?