Vps web hosting - 58 Introduction to Java Applications Chapter 2 Line

58 Introduction to Java Applications Chapter 2 Line 2, // A first program in Java. is a single-line comment that describes the purpose of the program. Good Programming Practice 2.2 Every program should begin with a comment describing the purpose of the program. Line 3 is simply a blank line. Programmers use blank lines and space characters to make programs easier to read. Together, blank lines, space characters and tab characters are known as white space. (Space characters and tabs are known specifically as white-space characters.) Such characters are ignored by the compiler. We discuss conventions for using white-space characters in this chapter and the next several chapters, as these spacing conventions are needed in may Java programs. Good Programming Practice 2.3 Use blank lines, space characters and tab characters to enhance program readability. Line 4, public class Welcome1 { begins a class definition for class Welcome1. Every program in Java consists of at least one class definition that is defined by you the programmer. These classes are known as programmer-defined classes, or user-defined classes. The class keyword introduces a class definition in Java and is immediately followed by the class name (Welcome1in this program). Keywords (or reserved words) are reserved for use by Java (we discuss the various keywords throughout the text) and are always spelled with all lowercase letters. The complete list of Java keywords is shown in Fig. 4.2. By convention, all class names in Java begin with a capital letter and have a capital letter for every word in the class name (e.g., SampleClassName). The name of the class is called an identifier. An identifier is a series of characters consisting of letters, digits, underscores ( _) and dollar signs ($) that does not begin with a digit and does not contain spaces. Some valid identifiers are Welcome1, $value, _value, m_inputField1 and button7. The name 7button is not a valid identifier, because it begins with a digit, and the name input field is not a valid identifier, because it contains a space. Java is case sensitive i.e., uppercase and lowercase letters are different, so a1 and A1 are different identifiers. Common Programming Error 2.2 Java is case sensitive. Not using the proper uppercase and lowercase letters for an identifier is normally a syntax error. Good Programming Practice 2.4 By convention, you should always begin a class name with a capital letter. Good Programming Practice 2.5 When reading a Java program, look for identifiers that start with capital letters. These identifiers normally represent Java classes. Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/2/01
Note: If you are looking for reliable webhost to maintain and run your java application check Vision java hosting services

Leave a Reply