2. Meaningful Names
• A good developer is careful to choose meaningful variable names.
Good Writing Not Good Writing
int radius; int r;
String gender; String gen;
Circle myCircle; Circle MyCircle;
int width; int widt;
3. • JAVA has key
words or reserved
words. An
identifier cannot
be the same as a
key word.
4. Code writing style
• Good program developers adhere to the following standards.
◦ Always include class documentation.
◦ Class name starts with upper-case letters.
◦ Variables name starts with lower-case letters.
◦ Align { and matching } in same column.
◦ Indent methods and statements.
◦ Use meaningful variable names.
◦ Use camelNotation.
5. Code Writing Style
• Some people prefer this arrangement of { and }
• It makes debugging and reading easier.
public class HelloWorld
{
public static void main (String[] args)
{
System.out.println(“Hello, World!”);
}
}
6. Some Remarks About JAVA Datatypes
• For calculations – like in math or physics class – use type double. It is the most accurate type
in JAVA.
• If you need to count things or controls loops use type int. Use long if you need to count a big
number of things.
• The type char basically represents an individual ASCII character.
• Type boolean can take on the values “true” or “false.”