From the course: Java for All Platforms: Desktop, Web, and Mobile Development

Unlock the full course today

Join today to access over 23,500 courses taught by industry experts.

Variables

Variables

- [Instructor] Because this is a basic Java course with really no prerequisites, we're going to go over the basics of the Java programming language. And we're going to start that conversation with variables. In Java, a variable is created by declaring, first, its data type, which, in this case, is String with a capital S, and then a space and the name of the variable. So let's call this my variable, capital V. And though it's not required in the language, the convention for Java is to name variables starting with a lowercase letter and then to use camel case, meaning each word in the variable starts with a capital letter, so just like this. You can set a value for a variable using the equal sign, so my variable equals. And then in double quotes, since we're using a string, the value of the variable. I'll just type in example value there. Now we have this red squiggly line here, because Java statements need to end…

Contents