A and a are different which letters represent valid

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t with underscore or dollar sign: _ $ • Java is case sensitive. A and a are different Which letters represent valid identifiers? a) b) c) abc m/h main d) e) f) $$$ 25or6to4 1_time i) j) k) a_1 student Number String Reserved Identifiers (keywords) A keyword is an identifier with a pre-defined meaning that can't be changed it's reserved double int Other Java reserved identifiers not a complete list boolean break case catch char class default do double else extends float for if import instanceOf int long new private public return void while Literals -- Java has 6 Floating-point literals 1.234 -12.5 1.2 3. .4 1e10 String literals "characters between double quotes" "'10" Integer literals (Integer.MIN and Ineger.MAX are shown) -1 0 1 -2147483648 2147483647 Boolean literals (there are only two) true false Null (there is only one) null Character literals 'A' 'b' '\n' '1' '' 0.1e-5 "_" Comments • • • • Provide internal documentation to explain program Provide external documentation with javadoc Helps programmers understand code--including their own There are three type of comments // on one line, or /* between slash star and star slash you can mash lines down real far, or */ /** * javadoc comments for external documentation * @return The square root of x */ public static double sqrt(double x) General Forms The book uses general forms to introduce parts of the Java programming language General forms provide information to create syntactically correct programs • Anything in yellow boldface must be written exactly as shown (println for example) • Anything in italic represents something that must be supplied by the user • The italicized portions are defined elsewhere Output Statements A statement, made up of tokens, is code that causes something to happen while the program runs General Forms for three output statements System.out.print( expression ); System.out.println(); System.out.println( expression ); Example Java code that writes text to the console System....
View Full Document

This note was uploaded on 01/25/2014 for the course CSC 227 taught by Professor Mercer during the Fall '12 term at Arizona.

Ask a homework question - tutors are online