\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-final.pdf) /Creator (Cheatography) /Author (NoxLupus (NoxLupus)) /Subject (CSC 201 final 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}{2E0E66} \definecolor{LightBackground}{HTML}{F8F7FA} \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 final Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{NoxLupus (NoxLupus)} via \textcolor{DarkBackground}{\uline{cheatography.com/46432/cs/15676/}}} \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 2nd May, 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*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Hello World}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{/{\emph{ Noc\_Luppus }}/ \newline import java.util.Date; \newline public class Hello \newline \{ \newline public static void main(String{[}{]} args) \newline \{ \newline System.out.println("100 {\emph{ 100 = 10,000 \& 1000 }} 100 = 100,000"); \newline \} \newline \} // dont forget me} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{program development}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{program development}} = WHAT} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{software design}} = HOW \& create the pseudocode with classes and objects needed} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{software implementation}} = requires the least amount of creativity} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{goal of {\bf{testing}} is to find logical and run-time errors} \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{class/method}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{public static void main(String{[} {]} args)}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{A {\bf{class constructor}} usually defines how an object is initialized} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{A Java{\bf{ variable}} is the name of a data value stored in memory that{\emph{ can change its value}} but {\emph{cannot change its type}} during the program's execution\{\{nl\}\} it all so can {\bf{contain}} a value or a reference} \tn % Row Count 8 (+ 5) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{local variable's scope}} is restricted to the method where it was declared} \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{Abstract methods}} are used when defining abstract classes \& Interfaces} \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{All classes in Java are directly or indirectly subclasses of the {\bf{Object class}}} \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{Autoboxing}} is the automatic creation of a wrapper object from its corresponding primitive type, {\emph{ it also provides a static constant}}} \tn % Row Count 17 (+ 3) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{method overloading}} = having multiple class methods of the same name where each method has a different number of or type of parameters} \tn % Row Count 20 (+ 3) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{If two variables contain {\bf{aliases}} of the same object thenthe object may be modified using either alias \& the object will become an "orphan" if both variables are set to null} \tn % Row Count 24 (+ 4) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Inheritance through an extended (derived) class supports {\bf{code reuse}}} \tn % Row Count 26 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{Instance data}} for a Java class may be primitive types or objects} \tn % Row Count 28 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{Static methods}} cannot reference instance data} \tn % Row Count 29 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{The advantages of the {\bf{DecimalFormat}} class compared with the {\bf{NumberFormat}} class include precise control over the number of digits to be displayed} \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{class/method (cont)}} \tn % Row 13 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{The {\bf{behavior}} of an object is defined by the object's methods} \tn % Row Count 2 (+ 2) % Row 14 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{The {\bf{relationship}} between a{\emph{ class and an object}} is best described as a objects are instances of classes} \tn % Row Count 5 (+ 3) % Row 15 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\emph{encapsulation, inheritance, polymorphism}} are the main programming mechanisms that {\bf{constitute object-oriented}} programming} \tn % Row Count 8 (+ 3) % Row 16 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{all clases can have any number of children but only one parent} \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{compareTo is not a method of the Object class} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{JavaFX}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{A color image is broken down into individual pixels in RGB} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{In a development environment that fully supports JavaFX, Since the launch method is called automatically, you do not need to write the {\bf{main method}}, and the {\bf{launch method}} is called automatically} \tn % Row Count 7 (+ 5) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{upper-left corner of a stage is (0,0)} \tn % Row Count 8 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{You should override the {\bf{start}} method in a JavaFX Application} \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Parent, Group, StackPane can be used as a {\bf{root}} node in a JavaFX, ImageView cannot} \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{the {\bf{javafx.scene.shape}} package includes classes that represent shapes in JavaFX} \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{windows}}is not a kind of object that is used to create a {\bf{g}}raphical {\bf{u}}ser {\bf{i}}nterface in JavaFX} \tn % Row Count 17 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{array}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{in Java, arrays are objects} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{int{[} {]} arr = new int{[}n{]};\{\{nl\}\}~~~ arr.length = n\{\{nl\}\}~~~ Index = 0 - n-1} \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{If a and b are both int arrays, then a = b; will create an alias} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{an int array is passed as a {\bf{parameter}} to a method you would say: (int{[} {]} a)} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{if the statement arr{[}-1{]} = 0, it will thrown the {\bf{ArrayIndexOutOfBoundsException}} Exceptions} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{The "{\bf{off-by-one}}" error associated with arrays arises because the first array index is 0 or the loop went to far} \tn % Row Count 13 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{str.charAt(2); could throw a \seqsplit{StringIndexOutOfBoundsException} becaus teh arry could be smaller than 3} \tn % Row Count 15 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Their lengths never change \& The shortest string has zero length these are properties are true of{\bf{ String }}objects} \tn % Row Count 18 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{sorting algorithms}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Neither method requires additional memory betwwen {\bf{selection sort}} and {\bf{insertion sort}}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{We {\bf{compare}} sorting algorithms by examining the number of instructions executed by the sorting algorithm} \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{the efficiency of binary search is {\bf{O(log2 n)}}} \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{enum Speed \{ FAST, MEDIUM, SLOW \}; zero = FAST} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{exspetoins}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{A finally clause will execute in any circumstance} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{An exception can produce a "{\bf{call stack trace}}" which lists: the active methods in the opposite order that they were invoked} \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{NullPointerException and ArithmeticException are both derived from the {\bf{RuntimeException}} class} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{unchecked}} exception requires no throws clause} \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{checked}} exception requires a throws clause} \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{When a program {\bf{terminates}} because a thrown exception is not handled, the program outputs a message indicating what and where the exception was thrown} \tn % Row Count 12 (+ 4) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{StringIndexOutOfBoundsException}} is for a string or arry trys to get a vule outside of the index of the object} \tn % Row Count 15 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{this is NOT a way: throw the exception to a pre-defined Exception class to be handled} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{UML}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{In a UML diagram for a class \& there may be a section containing the attributes (data) of the class \& there may be a section containing the name of the class \& classes are represented as rectangles} \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{DEFF}} \tn % Row 0 \SetRowColor{LightBackground} instantiation & creating a new object of the class \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Polymorphism & is achieved by overriding \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} flow of control & The idea that program instructions execute in order (linearly) unless otherwise specified \tn % Row Count 9 (+ 5) % Row 3 \SetRowColor{white} actual parameters & The expressions that are passed to a method in an invocation \tn % Row Count 12 (+ 3) % Row 4 \SetRowColor{LightBackground} exception propagation & is The list of methods is known as the {\emph{call stack}} and the method of searching them \tn % Row Count 17 (+ 5) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{call stack} \tn % Row Count 18 (+ 1) % Row 6 \SetRowColor{LightBackground} 0-9,\$,-,a-Z & allowed in an identifier \tn % Row Count 20 (+ 2) % Row 7 \SetRowColor{white} (,\{,{[} -{}-{}- (\textless{} does not) & needs an associated "closing" character \tn % Row Count 22 (+ 2) % Row 8 \SetRowColor{LightBackground} syntax & gramer \tn % Row Count 23 (+ 1) % Row 9 \SetRowColor{white} semantics & comperhentoin \tn % Row Count 24 (+ 1) % Row 10 \SetRowColor{LightBackground} base class is a parent class or super class & child \tn % Row Count 27 (+ 3) % Row 11 \SetRowColor{white} this & An object that refers to part of itself within its own methods can use this reserved word \tn % Row Count 32 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{DEFF (cont)}} \tn % Row 12 \SetRowColor{LightBackground} super & An object that access a parent class' constructor(s) , methods and instance data can use this reserved word \tn % Row Count 6 (+ 6) % Row 13 \SetRowColor{white} new & reserved words in Java is used to create an instance of a class \tn % Row Count 10 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{LOOPS}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{The {\bf{break statement}} transfers control out of the current control structure such as a switch statement} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{the do loop will always execute the body of the loop at least once, thewhile dose not} \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{all three loop statements are functionally equivalent\{\{nl\}\}{\bf{while loops}} and {\bf{do loops}} are essentially the same; but while loops always execute at least once \{\{nl\}\}\& if you know the number of times that a loop is to be performed, the best loop statement to use is a {\bf{while loop}} \{\{nl\}\}\& loops may be replaced by an appropriate combination of {\bf{if-else}} and switch statements} \tn % Row Count 13 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.89586 cm} x{4.08114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{modifiers}} \tn % Row 0 \SetRowColor{LightBackground} public & everyone can see \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{private} & only child can inderectly interact \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{protected} & only child can see \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} static & static means it belongs to the class not an instance \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{abstract} & are used when defining: abstract classes, derived classes \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} finsl & cannot be changed \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}