Java Cheat Sheet

Reviews
Shared by: armani11
Stats
views:
49
rating:
not rated
reviews:
0
posted:
11/9/2008
language:
pages:
0
Java Cheat Sheet found at http://mindprod.com/jgloss/jcheat.html Control Structures // I F / E L S E if ( a > b ) { System.out.println ( a ); } else { System.out.println ( b ); } // I F / E L S E : is x in range low .. high? if ( low <= x && x <= high ) { System.out.println ( } "in range" ); else { System.out.println ( } "out of range" ); // S W I T C H / C A S E switch ( { n ) case 1: System.out.println ( "one" ); break; case 2: System.out.println ( "two" ); break; default: System.out.println ( }// end switch (n) Loops "something else" ); // F O R // Note lack of ; after i++ for ( int i=0 ; i=0 ; i-- ) { System.out.println( i ); } // D U A L F O R // Note lack of ; after j++ for ( int i = 0 ,j = 0; i>>. 4 << >> >>> Left (infix) 5 6 7 < > <= >= instanceof == != & Left (infix) Left (infix) Left (infix) Pascal's <> not equal will not work. == and != work on booleans too, often saving a forest of if/elses. Bitwise AND mostly for for ints. XOR for ints. It is the difference operator. It is true if the boolean operands are different. e.g. false ^ false == false false ^ true == true true ^ false == true true ^ true == false 8 ^ Left (infix) It is useful in cryptography because of this magic property of encryption and decryption with a random scrambler number. long encrypted = message ^ scrambler ; long decryped = encrypted ^ scrambler ; If you XOR twice with the scrambler, you get right back where you started. For booleans it is clearer to use a != b instead of a ^ b and a == b instead of !( a ^ b) 9 10 11 12 | && || ?: = *= /= += -= <<= >>= >>>= &= ^= |= Left (infix) Left (infix) Left (infix) Right ( ternary ) bitwise OR mostly for ints. short circuit logical AND for booleans. short circuit logical OR for booleans. a = b ? c : d; is shorthand for if ( b ) a = c; else a = d; 13 Right (infix) These make proofreading easier by eliminating typing a variable name twice. Keywords Java Keywords abstract do boolean break byte case double else extends final import public throws transient try void volatile Page 7 Course Syllabus instanceof return int interface long short static strictfp POS 407 -- Computer Programming II catch char class finally float for native new package private super switch synchronized this while continue if default implements protected throw Reserved keywords (not currently in use) const goto Reserved Literals null true false JavaDoc /** FormattedTextField.java * @author Roedy Green * @version 1.34 1998 January 18 * @deprecated Noreplacement * @deprecated Replaced by otherMethod(int) * @see otherMethod * @see #otherMethod * @see java.awt.Component#repaint * @see Java & Internet Glossary * @see "design patterns by Gamma et. al" * @param x pixels right of the origin. * @return number of oranges. * @exception java.beans.PropertyVetoException when mask is invalid * @since JDK1.1 */ POS 407 -- Computer Programming II Page 8 Course Syllabus

Related docs
Java Cheat Sheet
Views: 43  |  Downloads: 3
Java Cheat Sheet
Views: 135  |  Downloads: 20
Java Cheat Sheet
Views: 44  |  Downloads: 10
Java Cheat Sheet- Abbreviated Version
Views: 13  |  Downloads: 6
Basic Java Cheat Sheet
Views: 335  |  Downloads: 16
HP JAVA Cheat Sheet
Views: 17  |  Downloads: 4
Java Graphics Cheat Sheet
Views: 220  |  Downloads: 17
JAVA SYNTAX CHEAT SHEET
Views: 0  |  Downloads: 0
HP JAVA Cheat Sheet
Views: 1  |  Downloads: 0
Erichs Java cheat sheet for C++ programmers
Views: 28  |  Downloads: 0
Cheat Sheet
Views: 2  |  Downloads: 0
premium docs
Other docs by armani11
CorpDocs-Articles of Incorporation California
Views: 352  |  Downloads: 22
Board Resolution Declaring Stock Dividend
Views: 229  |  Downloads: 3
Employee Rejection Letter
Views: 1910  |  Downloads: 7
Central Contractor Registration Form
Views: 586  |  Downloads: 7
iVillage Inc Ammendments and Bylaws
Views: 210  |  Downloads: 0
Board Resolution Re Amending Corporate Bylaws
Views: 241  |  Downloads: 6
Form T (Timber) (PDF) Forest Activities Schedule
Views: 257  |  Downloads: 1
DEMAND ON GUARANTOR
Views: 226  |  Downloads: 0
NOTICE OF BUYER S DISPOSITION OF REJECTED GOODS
Views: 235  |  Downloads: 0
CorpDocs-Board Resolution Changing Board Size
Views: 161  |  Downloads: 1