\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{NoxLupus (NoxLupus)} \pdfinfo{ /Title (csc-201-slides.pdf) /Creator (Cheatography) /Author (NoxLupus (NoxLupus)) /Subject (csc 201 slides Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{1B1B59} \definecolor{LightBackground}{HTML}{F7F7F9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{csc 201 slides Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{NoxLupus (NoxLupus)} via \textcolor{DarkBackground}{\uline{cheatography.com/46432/cs/15490/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}NoxLupus (NoxLupus) \\ \uline{cheatography.com/noxlupus} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 18th April, 2018.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Program Development}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{4 phases}}\{\{nl\}\} \{\{fa-circle\}\} establishing the requirements: {\bf{what}} \{\{nl\}\} \{\{fa-circle\}\} creating a design: {\bf{how}} , which classes and objects are needed \{\{nl\}\} \{\{fa-circle\}\} implementing the code: least creative step \{\{nl\}\} \{\{fa-circle\}\} testing the implementation: Testing attempts to ensure that the program will solve the intended problem under all the constraints specified in the requirements} \tn % Row Count 9 (+ 9) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{OBJ desine}}\{\{nl\}\} The core activity of object-oriented design is determining the classes and objects that will make up the solution} \tn % Row Count 12 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Three of the most common {\bf{relationships}}: \{\{nl\}\} ~ ~ ~ ~ ~ \{\{fa-circle\}\} Dependency: A uses B \{\{nl\}\}don't want numerous or complex dependencies, or complex classes with out dependency\{\{nl\}\} some happen in same class, like: `str3 = str1.concat(str2);` {\emph{(When an object is passed to a method, the actual parameter and the formal parameter become aliases of each other)}} \{\{nl\}\} ~ ~ ~ ~ ~ \{\{fa-circle\}\} Inheritance: A is-a B \{\{nl\}\} Inheritance allows a software developer to derive a new class from an existing one \{\{nl\}\} ~ ~ ~ ~ ~ \{\{fa-circle\}\} Aggregation: A has-a B \{\{nl\}\} aggregate is an object that is made up of other objects} \tn % Row Count 27 (+ 15) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Class Rules}}\{\{nl\}\}When a class becomes too complex, it often should be decomposed into multiple smaller classes to distribute the responsibilities} \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Program Development (cont)}} \tn % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Method Rules}}\{\{nl\}\} Every method implements an algorithm that determines how the method accomplishes its goals \{\{nl\}\} A potentially large method should be decomposed into several smaller methods as needed for clarity and may use support methods} \tn % Row Count 5 (+ 5) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{we shou stop {\bf{testing}} when we think teh risk of unsoved error is lowenuff \{\{nl\}\} \{\{fa-circle\}\} test case: set of input and user actions, coupled with the expected results\{\{nl\}\} \{\{fa-circle\}\} test suites: formally organized test cases which are stored and reused as needed \{\{nl\}\} \{\{fa-circle\}\} Defect testing: is the execution of test cases \{\{nl\}\} \{\{fa-circle\}\} regression testing: running previous test suites to ensure new errors \{\{nl\}\} \{\{fa-circle\}\} black-box testing: is when a test cases are developed without considering the internal logic \{\{nl\}\} \{\{fa-circle\}\} White-box testing: focuses on the internal structure of the code where that every path through the code is tested} \tn % Row Count 19 (+ 14) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Objects are generally nouns, and the services that an object provides are generally verbs \newline A good testing effort will include both black-box and white-box tests} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Polymorphism}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Polymorphism is an object-oriented concept that allows us to create versatile software designs} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{polymorphic reference}}: a variable that can refer to different types of objects at different points in time} \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{The method invoked through a polymorphic reference can change from one invocation to the next \{\{nl\}\} All object references in Java are potentially polymorphic} \tn % Row Count 9 (+ 4) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Java allows this {\bf{reference to point}} to it's constructor object, or to any object of any compatible type \{\{nl\}\} This {\bf{compatibility}} can be established using inheritance or using interfaces} \tn % Row Count 13 (+ 4) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Assigning a child object to a parent reference is considered to be a widening conversion, and a narrowing for the other way arownd. {\emph{(The widening conversion is the most useful)}}} \tn % Row Count 17 (+ 4) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{An interface name can be used as the type of an object reference variable `Speaker current;` The current reference can be used to point to any object of any class that implements the Speaker interface} \tn % Row Count 21 (+ 4) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{\{bt\}\}{\bf{Selection Sort}}: find the smallest value in the list switch it with the value in the first position find the next smallest value in the list switch it with the value in the second position repeat until all values are in their proper places \{\{nl\}\} The sorting method needs to be able to call the compareTo method\{\{nl\}\} {\bf{Insertion Sort}}:consider the first item to be a sorted sublist (of one item) insert the second item into the sorted sublist, shifting the first item as needed to make room to insert the new addition insert the third item into the sorted sublist (of two items), shifting items as necessary repeat until all values are inserted into their proper positions} \tn % Row Count 35 (+ 14) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Polymorphism (cont)}} \tn % Row 7 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Swapping}}(used for the selection sort algorithm) requires three assignment statements and a temporary storage location:\{\{nl\}\}`temp = first; \{\{nl\}\} first = second;\{\{nl\}\}second = temp; `} \tn % Row Count 4 (+ 4) % Row 8 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Recall that an class that implements the Comparable interface defines a compareTo method to determine the relative order of its objects\{\{nl\}\} We can use polymorphism to develop a generic sort for any set of Comparable objects} \tn % Row Count 9 (+ 5) % Row 9 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Searching}} is the process of finding a target element within a group of items called the {\emph{search pool}}, the taget might not exsist \{\{nl\}\}{\bf{Linear Search}}:A linear search begins at one end of a list and examines each element in turn Eventually, either the item is found or the end of the list is encountered \{\{nl\}\}{\bf{Binary Search}}:{\emph{assumes the list is sorted}} then dose the: is hafe value =, \textless{} or \textgreater{} then move acordingly, repeet until =} \tn % Row Count 18 (+ 9) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Looping}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{8.4cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/noxlupus_1523995390_81zv3N+XEML._SL1500_.jpg}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Arrays}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{An array is an ordered list of values \{\{nl\}\}An array of size N is indexed from zero to N-1} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{scores{[}2{]} refers the 3rd value in the array} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{The values held in an array are called {\bf{array elements}}} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{An array stores multiple values of the same type the {\bf{element type}}, The element type can be a primitive type or an object reference} \tn % Row Count 8 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{In Java, the array itself is an object that must be instantiated} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{`type{[}{]} name = new type{[}n{]};` \{\{nl\}\} fixed size = n, index = 0-n-1} \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{If an array index is out of bounds, the Java interpreter throws an \{\{nl\}\} {\emph{ArrayIndexOutOfBoundsException}}\{\{nl\}\} This is called automatic bounds checking} \tn % Row Count 16 (+ 4) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Each array object has a public constant called length that stores the size of the array: name.legth or name.legth() \textasciicircum{}size not index\textasciicircum{}} \tn % Row Count 19 (+ 3) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{An {\bf{iterator}} is an object that implements the Iterator interface \{\{nl\}\} An iterator object provides a means of processing a collection of objects one at a time \textasciicircum{}Several classes in the Java standard class library are iterators (including Arrays)\textasciicircum{}} \tn % Row Count 24 (+ 5) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{An iterator is created formally by implementing the Iterator interface, which contains three methods \{\{nl\}\} `hasNext()`: returns a boolean result – true if there are items left to process \{\{nl\}\} `next()`: returns the next object in the iteration \{\{nl\}\} `remove()`: removes the object most recently returned by the next method} \tn % Row Count 31 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Arrays (cont)}} \tn % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{float{[}{]} prices; = float prices{[}{]};} \tn % Row Count 1 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{`int{[}{]} units = \{147, 323, 89, 933, 540, 269, 97, 114, 298, 476\}; \{\{nl\}\}char{[}{]} letterGrades = \{'A', 'B', 'C', 'D', 'F'\}; \{\{nl\}\}String{[}{]} verbs = \{"play", "work", "eat", "sleep"\};`} \tn % Row Count 5 (+ 4) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{An entire array can be passed as a parameter to a method Like any other object, the reference to the array is passed, making the formal and actual parameters aliases of each other Therefore, changing an array element within the method changes the original An individual array element can be passed to a method as well, in which case the type of the formal parameter is the same as the element type} \tn % Row Count 13 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{JavaFX}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{The GUI designer should: \{\{nl\}\}~~~~ Know the user \{\{nl\}\}~~~~ Prevent user errors \{\{nl\}\}~~~~ Optimize user abilities \{\{nl\}\}~~~~ Be consistent \{\{nl\}\} ~~ Whenever possible, we should design user interfaces that minimize possible user mistakes \{\{nl\}\}~~ Error messages should guide the user appropriately \{\{nl\}\}~~ We should choose the best GUI components for each task \{\{nl\}\}~~ We should provide multiple ways to accomplish a task whenever reasonable(ctrl-C)} \tn % Row Count 12 (+ 12) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{JavaFX programs extend the abstract Application class, inheriting core graphical functionality} \tn % Row Count 14 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{launch method}} sets up the basic graphical interface and calls the start method.(must have this sice inhareted as abstract) \{\{nl\}\} The {\bf{main method}} is only needed to call the inherited launch method(some IDEs dont need this method)} \tn % Row Count 19 (+ 5) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{stage}}: is the window and holds one scene at a time \{\{nl\}\} {\bf{scene}}: set up for what is on the window} \tn % Row Count 22 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{the top left corner of the scen is (0,0) all other points are the abs on that like: (112,40)} \tn % Row Count 24 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{RGB}} rang of 0-255 \{\{nl\}\} The static rgb method usees specific RGB value \{\{nl\}\}~~~ `Color purple = Color.rgb(183, 44, 150);` \{\{nl\}\}The color method uses percentages: \{\{nl\}\}~~~ `Color maroon = Color.color(0.6, 0.1, 0.0);`} \tn % Row Count 30 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{JavaFX (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{GUI}} in Java is created with at least three kinds of {\bf{objects}}: {\emph{controls}}, {\emph{events}} (is an object that represents some activity to which we may want to respond), and {\emph{event handlers}}(called a listener)(must accept an ActionEvent object as a parameter)} \tn % Row Count 6 (+ 6) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Basic Shapes}} \{\{nl\}\} `Line(startX, startY, endX, endY)` \{\{nl\}\} `Rectangle(x, y, width, height)` \{\{nl\}\} `Circle(centerX, centerY, radius)` \{\{nl\}\} `Ellipse(centerX, centerY, radiusX, radiusY)` \{\{nl\}\} `Arc(centerX, centerY, radiusX, radiusY, startAngle, arcLength)`} \tn % Row Count 12 (+ 6) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Translating a shape or group shifts its position along the x or y axis\{\{ln\}\} A shape or group can be rotated using the setRotate method} \tn % Row Count 15 (+ 3) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{images}} \{\{nl\}\} `Image logo = new \seqsplit{Image("myPix/smallLogo.png");`} \{\{nl\}\} `imgView.setViewport(new Rectangle2D(200, 80, 70, 60));`} \tn % Row Count 18 (+ 3) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{A {\bf{stack pane}} stacks its nodes on top of each other. Since the image view is the only node in the pane, the stack pane simply serves to keep the image centered in the window} \tn % Row Count 22 (+ 4) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{A text field allows the user to enter one line of input} \tn % Row Count 24 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{All visual components must be attached to a {\bf{scene}}. \newline that scene must be attached to a {\bf{stage}}. \newline The set of all visual componentsin a scene is called the {\bf{scene graph}}. \newline All visual components attached to the scene graph are called {\bf{nodes}}. \newline A {\bf{branch}} node is a node that can contain other nodes. \newline A {\bf{leaf}} node is a node which cannot contain other nodes. \newline The{\bf{ root}} node is the primary container for a scene graph} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Branching: if, switch}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{The order of statement execution is called the {\bf{flow of control}}. it gose strait though unless:\{\{nl\}\}{\bf{Repetition statements}}: execute a statement over and over, repetitively\{\{nl\}\}{\emph{{[}if statement, if-else statement, switch statement{]}}}\{\{nl\}\}{\bf{Conditional statements}}: decide whether or not to execute a particular statement\{\{nl\}\}{\emph{{[}the while loop, the do loop, the for loop{]}}}} \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{== ~~~~ equal to \{\{nl\}\}!= ~~~~~ not equal to \{\{nl\}\}\textless{} ~~~~~~ less than \{\{nl\}\}\textgreater{} ~~~~~~ greater than \{\{nl\}\}\textless{}= ~~~~ less than or equal to\{\{nl\}\} \textgreater{}= ~~~~ greater than or equal to} \tn % Row Count 15 (+ 7) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{|| ~~~~~~ Logical OR \{\{nl\}\}\&\& ~~~~ Logical AND \{\{nl\}\}! ~~~~~~~ Logical NOT} \tn % Row Count 19 (+ 4) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{`if (sum \textgreater{} MAX) \{\{nl\}\}~~~ delta = sum - MAX; \{\{nl\}\}System.out.println ("The sum is " + sum);`\{\{nl\}\}If the condition is true, the assignment statement is execif it isn't, it is skipped. {\emph{Either way, the call to println is executed next}}} \tn % Row Count 25 (+ 6) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{nested if statements}}: if() \{ if() \{ \} \}else \{ \} \{\{nl\}\}An else clause is matched to the last unmatched if (no matter what the indentation implies)} \tn % Row Count 28 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{comparing}}: floats: (Math.abs(f1 - f2) \textless{} TOLERANCE)\{\{nl\}\} Characters: a!=A \{\{nl\}\}(0-9 = 48-57, A-Z = 65-90, a-z 97-122) \{\{nl\}\}String: (name1.equals(name2)) \{\{nl\}\}{\emph{(if you use the staight == then: it will only be true if the two String objects are aliases of each other}} \textasciicircum{}{\bf{this is the same for all objects}}\textasciicircum{}{\emph{)}}\{\{nl\}\}or name1.compareTo(name2) gives a pos neg of 0 out as the compaison value \{\{nl\}\}} \tn % Row Count 37 (+ 9) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Branching: if, switch (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{`switch (option)\{\{nl\}\} \{\{\{nl\}\} ~~ case 'A': \{\{nl\}\} ~~~~ aCount++; \{\{nl\}\} ~~~~ break; \{\{nl\}\} ~~ case 'B':\{\{nl\}\} ~~~~ bCount++; \{\{nl\}\} ~~~~ break;\{\{nl\}\} ~~ case 'default':\{\{nl\}\} ~~~~ cCount++; \{\{nl\}\} ~~~~ break; \{\{nl\}\}\}`} \tn % Row Count 8 (+ 8) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{A switch statement can have an optional default case The default case has no associated value and simply uses the reserved word default If the default case is present, control will transfer to it if no other case value matches If there is no default case, and no other value matches, control falls through to the statement after the switch} \tn % Row Count 15 (+ 7) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{The expression of a switch statement must result in an integral type, meaning an int or a char} \tn % Row Count 17 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{One {\bf{listener object}} can be used to listen to two different components\{\{nl\}\} The source of the event can be determined by using the getSource method of the event passed to the listener} \tn % Row Count 21 (+ 4) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Conditional Operator}} `condition ? expression1 : expression2` \{\{nl\}\}If the condition is true, expression1 is evaluated; if it is false, expression2 is evaluated\{\{nl\}\}The conditional operator is similar to an if-else statement, except that it is an expression that returns a value} \tn % Row Count 27 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}