94 Introduction to Java Applications Chapter 2 (Remote web server)

94 Introduction to Java Applications Chapter 2 Keyword class introduces a class definition and is immediately followed by the class name. Keywords (or reserved words) are reserved for use by Java. Keywords must appear in all lowercase letters. By convention, all class names in Java begin with a capital letter. If a class name contains more than one word, the first letter of each word should be capitalized. An identifier is a series of characters consisting of letters, digits, underscores ( _) and dollar signs ($) that does not begin with a digit, does not contain any spaces and is not a keyword. Java is case sensitive that is, uppercase and lowercase letters are different. A left brace, {, begins the body of every class definition. A corresponding right brace, }, ends each class definition. Java applications begin executing at method main. Methods are able to perform tasks and return information when they complete their tasks. The first line of method main must be defined as public static void main( String args[] ) A left brace, {, begins the body of a method definition. A corresponding right brace, }, ends the method definition s body. System.out is known as the standard output object. System.out allows Java applications to display strings and other types of information in the command window from which the Java application executes. The escape sequence n indicates a newline character. Other escape sequences include t (tab), r (carriage return), \ (backslash) and ” (double quote). Method println of the System.out object displays (or prints) a line of information in the command window. When println completes its task, it automatically positions the output cursor to the beginning of the next line in the command window. Every statement must end with a semicolon (also known as the statement terminator). The difference between System.out s print and println methods is that print does not position to the beginning of the next line in the command window when it finishes displaying its argument. The next character displayed in the command window appears immediately after the last character displayed with print. Java contains many predefined classes that are grouped into categories of related classes called packages. The packages are referred to collectively as the Java class library or the Java applications programming interface (Java API). Class JOptionPane is defined in package javax.swing. Class JOptionPane contains methods that display dialog boxes. The compiler uses import statements to locate classes required to compile a Java program. The javax.swing package contains many classes that help define a graphical user interface (GUI) for an application. GUI components facilitate data entry by the user of a program and data outputs by a program. Method showMessageDialog of class JOptionPane displays a dialog box containing a message to the user. A staticmethod is called by following its class name by a dot (.) and the name of the method. Method exit of class System terminates an application. Class System is in package java.lang. All Java programs import package java.lang by default. Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/2/01
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check Vision mysql hosting services

Leave a Reply