Читать книгу OCP Oracle Certified Professional Java SE 17 Developer Study Guide - Jeanne Boyarsky - Страница 102

Declaring Variables

Оглавление

You've seen some variables already. A variable is a name for a piece of memory that stores data. When you declare a variable, you need to state the variable type along with giving it a name. Giving a variable a value is called initializing a variable. To initialize a variable, you just type the variable name followed by an equal sign, followed by the desired value. This example shows declaring and initializing a variable in one line:

String zooName = "The Best Zoo";

In the following sections, we look at how to properly define variables in one or multiple lines.

OCP Oracle Certified Professional Java SE 17 Developer Study Guide

Подняться наверх