Fundamentals of Programming with Java

– All programming languages share common traits
– Java in particular is an Object Oriented programming language
– Everything can be represented as an Object (think of of nouns in the English language)
– a Chair, a Desk, a Person, a User etc.


– What is a variable?
– In computer programming, a variable is a storage location and an associated symbolic name which contains some known or unknown quantity or information, a value.

– cryptic, here's what it really means:
– Store information for later use, and store it in a way that you can reference it
– this is known as a variable name!
– variable name is just a word, a word that represent's what you're storing

– if you go to a website, website asks for your name, you type it in, boom that's a variable

Variables have Types

– String – store a regular sentence (alphanumeric – numbers and letters)
– Integer – Whole numbers on (no decimals)
– Double – Number with decimals (about 16 significant figures)
– Float – Number with fewer decimal places than Double (about 8 significant figures)

Rules for Creating Variables

  • Variables should start with a lower case letter
  • Variables shouldn't have spaces in their names (it's not allowed)
    • If you absolutely HAVE to simulate a space in a variable name, use an underscore (_)
  • If your variable has multiple words in it, just use camel casing, for example:
    • String thisIsMyVariableNameWithoutSpacesAndItUsesCamelCasing
    • Note: as a rule of thumb, variable names should be no more than 4 or 5 words stuck together
  • You can't begin a variable name with a number, it has to be a letter or an underscore (_)
  • Your Homework

Free Java Beginners Course

Start learning how to code today with our free beginners course. Learn more.