You have seen most of Java building blocks now. They are:
Project: the top level structure which might have several classes. You can also call a project a package because it typically holds multiple related classes;
Class: a class is part of a project / package and may have multiple functions;
Function: a function is part of a class and may have multiple variables;
Variable: a variable is part of a function and may have multiple values. A variable is of a certain type such as int or String. A variable can only store values of that type, for instance int x = 1.0; is wrong because 1.0 is not int. int x = 1 ; is correct.
B. Java Naming Conventions:
All of the above should be named appropriately so the program is easy to understand and maintain. Below are the conventions of all identifiers:
Names must start with a letter or the underscore '_' , and the remaining characters must be letters, numbers, or underscores.
No other symbols such as '?' or '%'.
Spaces are not permitted inside names. (You can use uppercase letters to denote word boundaries, as in milesPerGallon. This naming convention is called camel case because the uppercase letters in the middle of the name look like the humps of a camel.)
Names are case sensitive, that is, milesPerGallon and milespergallon are different names.
You cannot use reserved words such as double or class as names; these words are reserved exclusively for their special Java meanings. Your code won't compile if you use the reserved keywords.
Class names should be nouns, with the first letter of each word capitalized.
Methods should be verbs, with the first letter in lowercase and the rest in camel case.
Variable names should be nouns, with the first letter in lowercase and the rest in camel case. They should indicate to the casual observer the intent of its use.
Variable names should not start with underscore '_ ' or dollar sign ‘$’.
One-character variable names should be avoided except for temporary uses.
C. Which of the following are legal identifiers?
Greeting1 g void 101dalmatians Hello, World <greeting>