\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{Bayan (Bayan.A)}
\pdfinfo{
  /Title (java-mastery-advanced.pdf)
  /Creator (Cheatography)
  /Author (Bayan (Bayan.A))
  /Subject (Java Mastery - Advanced 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}{A3A3A3}
\definecolor{LightBackground}{HTML}{F3F3F3}
\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{Java Mastery - Advanced Cheat Sheet}}}} \\
    \normalsize{by \textcolor{DarkBackground}{Bayan (Bayan.A)} via \textcolor{DarkBackground}{\uline{cheatography.com/122738/cs/31568/}}}
\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}Bayan (Bayan.A) \\
  \uline{cheatography.com/bayan-a} \\
  \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 19th July, 2023.\\
   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{1.08 cm} x{1.872 cm} x{2.088 cm} x{2.16 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{4}{x{8.4cm}}{\bf\textcolor{white}{Ternary Operator}}  \tn
% Row 0
\SetRowColor{LightBackground}
\mymulticolumn{4}{x{8.4cm}}{A shortcut to assigning one of two values to a variable depending on a given condition} \tn 
% Row Count 2 (+ 2)
% Row 1
\SetRowColor{white}
\mymulticolumn{4}{x{8.4cm}}{Like an {\bf{if-then-else}} statement} \tn 
% Row Count 3 (+ 1)
% Row 2
\SetRowColor{LightBackground}
\mymulticolumn{4}{x{8.4cm}}{Question mark comes after the condition} \tn 
% Row Count 4 (+ 1)
% Row 3
\SetRowColor{white}
\mymulticolumn{4}{x{8.4cm}}{After the question mark, two values that can return are separated by a colon (:)} \tn 
% Row Count 6 (+ 2)
% Row 4
\SetRowColor{LightBackground}
Takes 3 \seqsplit{operands:} & condition {\bf{?}} & operand1  {\bf{:}} & operand2 \tn 
% Row Count 9 (+ 3)
% Row 5
\SetRowColor{white}
 & {\bf{Condition}} we're testing against & {\bf{First value}} to assign if first condition was true & {\bf{Second value}} to assign if first condition was false \tn 
% Row Count 14 (+ 5)
% Row 6
\SetRowColor{LightBackground}
\mymulticolumn{4}{x{8.4cm}}{Example:} \tn 
% Row Count 15 (+ 1)
% Row 7
\SetRowColor{white}
\mymulticolumn{4}{x{8.4cm}}{`int age = 20`} \tn 
% Row Count 16 (+ 1)
% Row 8
\SetRowColor{LightBackground}
\seqsplit{`boolean} \seqsplit{isOver18} =` & `(age == 20) ?` & `true : ` & `false` \tn 
% Row Count 20 (+ 4)
% Row 9
\SetRowColor{white}
 & is age equal to 20? & if it is, `isOver18= true` & if false, `isOver18 = false` \tn 
% Row Count 23 (+ 3)
\hhline{>{\arrayrulecolor{DarkBackground}}----}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{x{4.88 cm} x{3.12 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Operator Abbreviation}}  \tn
% Row 0
\SetRowColor{LightBackground}
{\bf{Original}} & {\bf{Abbreviated}} \tn 
% Row Count 1 (+ 1)
% Row 1
\SetRowColor{white}
`result = result + 1;` & `result++;` \tn 
% Row Count 2 (+ 1)
% Row 2
\SetRowColor{LightBackground}
`result = result - 1;` & `result-{}-;` \tn 
% Row Count 3 (+ 1)
% Row 3
\SetRowColor{white}
`result = result + 2;` & `result += 2;` \tn 
% Row Count 4 (+ 1)
% Row 4
\SetRowColor{LightBackground}
`result = result * 10;` & `result *= 10;` \tn 
% Row Count 5 (+ 1)
% Row 5
\SetRowColor{white}
`result = result / 3;` & `result /= 3;` \tn 
% Row Count 6 (+ 1)
% Row 6
\SetRowColor{LightBackground}
`result = result - 2;` & `result -= 2;` \tn 
% Row Count 7 (+ 1)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{x{2.64 cm} x{5.36 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Access Modifiers}}  \tn
% Row 0
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{8.4cm}}{These are java keywords} \tn 
% Row Count 1 (+ 1)
% Row 1
\SetRowColor{white}
\mymulticolumn{2}{x{8.4cm}}{Allows defining the scope, how other parts of the code can access this code} \tn 
% Row Count 3 (+ 2)
% Row 2
\SetRowColor{LightBackground}
{\bf{Access Modifiers}} & {\bf{Access Levels}} \tn 
% Row Count 5 (+ 2)
% Row 3
\SetRowColor{white}
public & Same Class, same package, other subclass, other package \tn 
% Row Count 8 (+ 3)
% Row 4
\SetRowColor{LightBackground}
protected & Same Class, same package, other subclass \tn 
% Row Count 10 (+ 2)
% Row 5
\SetRowColor{white}
no access modifier & Same Class, same package \tn 
% Row Count 12 (+ 2)
% Row 6
\SetRowColor{LightBackground}
private & Same Class \tn 
% Row Count 13 (+ 1)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{x{2.16 cm} x{2.232 cm} x{1.368 cm} x{1.44 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{4}{x{8.4cm}}{\bf\textcolor{white}{Code comments}}  \tn
% Row 0
\SetRowColor{LightBackground}
\mymulticolumn{4}{x{8.4cm}}{These are used to describe methods for quick reference with an IDE} \tn 
% Row Count 2 (+ 2)
% Row 1
\SetRowColor{white}
Start comment block: & /** & End \seqsplit{comment} block: & */ \tn 
% Row Count 5 (+ 3)
% Row 2
\SetRowColor{LightBackground}
Describe method: & `Computes sum of two arguments` &  &  \tn 
% Row Count 8 (+ 3)
% Row 3
\SetRowColor{white}
Describe parameters & `@param a` & an int \seqsplit{operand} &  \tn 
% Row Count 10 (+ 2)
% Row 4
\SetRowColor{LightBackground}
 & `@param b` & an int \seqsplit{operand} &  \tn 
% Row Count 12 (+ 2)
% Row 5
\SetRowColor{white}
Describe what method returns: & `@ return ` & the sum of a and b &  \tn 
% Row Count 15 (+ 3)
% Row 6
\SetRowColor{LightBackground}
Method described: & `public ` & \seqsplit{`static} int ` & \seqsplit{`sum(int} a, int b)` \tn 
% Row Count 18 (+ 3)
\hhline{>{\arrayrulecolor{DarkBackground}}----}
\SetRowColor{LightBackground}
\mymulticolumn{4}{x{8.4cm}}{Full example:  \newline  `/{\emph{*` \newline     ` }} Computes the sum of two arguments.` \newline    `  {\emph{` \newline     ` }} @param a an int operand to be added` \newline     ` {\emph{ @param b another int operand` \newline    `  }} @return the sum of a and b` \newline     ` */` \newline     `public static int sum(int a, int b)`}  \tn 
\hhline{>{\arrayrulecolor{DarkBackground}}----}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{p{0.72 cm} x{2.232 cm} x{1.872 cm} x{2.376 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{4}{x{8.4cm}}{\bf\textcolor{white}{For loop}}  \tn
% Row 0
\SetRowColor{LightBackground}
\mymulticolumn{4}{x{8.4cm}}{For loops are used when you know exactly how many times you want to loop through a block of code} \tn 
% Row Count 2 (+ 2)
% Row 1
\SetRowColor{white}
`for` & `(statement 1;` & \seqsplit{`statement} 2;` & `statement 3) \{  \}` \tn 
% Row Count 4 (+ 2)
% Row 2
\SetRowColor{LightBackground}
`for` & `(int i = 0;` & `i \textless{} 5;` & `i++) \{  \} ` \tn 
% Row Count 6 (+ 2)
% Row 3
\SetRowColor{white}
 & sets a variable before the loop starts & Defines the condition for the loop to run. If true, the loop will start over again, if false, the loop will end. & increases a value (i++) each time the code block in the loop has been executed. \tn 
% Row Count 18 (+ 12)
\hhline{>{\arrayrulecolor{DarkBackground}}----}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{x{1.728 cm} x{3.024 cm} x{1.728 cm} p{0.72 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{4}{x{8.4cm}}{\bf\textcolor{white}{For-Each Loop}}  \tn
% Row 0
\SetRowColor{LightBackground}
\mymulticolumn{4}{x{8.4cm}}{Used exclusively to loop through elements in an array:} \tn 
% Row Count 2 (+ 2)
% Row 1
\SetRowColor{white}
`for` & `(type variableName` & `: \seqsplit{arrayName)`} {[}{]} &  \tn 
% Row Count 4 (+ 2)
% Row 2
\SetRowColor{LightBackground}
\mymulticolumn{4}{x{8.4cm}}{e.g.} \tn 
% Row Count 5 (+ 1)
% Row 3
\SetRowColor{white}
`String{[}{]} cars =` & ` \{"Volvo", "BMW", "Ford", "Mazda"\};` &  &  \tn 
% Row Count 8 (+ 3)
% Row 4
\SetRowColor{LightBackground}
for ` & `(String i` & `: cars)` &  \tn 
% Row Count 9 (+ 1)
% Row 5
\SetRowColor{white}
 & \seqsplit{`System.out.println(i);`} &  &  \tn 
% Row Count 11 (+ 2)
\hhline{>{\arrayrulecolor{DarkBackground}}----}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{x{1.28 cm} x{6.72 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{While Loops}}  \tn
% Row 0
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{8.4cm}}{A while loop will execute the enclosed statement as long as a boolean condition remains true.} \tn 
% Row Count 2 (+ 2)
% Row 1
\SetRowColor{white}
\seqsplit{Syntax:} & `while (boolean\_condition) statemen` \tn 
% Row Count 4 (+ 2)
% Row 2
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{8.4cm}}{The condition must be boolean.} \tn 
% Row Count 5 (+ 1)
% Row 3
\SetRowColor{white}
\mymulticolumn{2}{x{8.4cm}}{If the condition never becomes false, the loop never exits, and the program never stops.} \tn 
% Row Count 7 (+ 2)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{8.4cm}}{Example: \newline `n = 1;` \newline `while (n \textless{} 4) \{` \newline   `   System.out.println(n + " squared is " + (n * n));` \newline  `      n = n + 1;` \newline `\}` \newline Result: \newline `1 squared is 1` \newline `2 squared is 4` \newline `3 squared is 9`}  \tn 
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{x{2 cm} x{6 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{When do you use each loop}}  \tn
% Row 0
\SetRowColor{LightBackground}
for loop & if you know ahead of time how many times you want to go through the loop. \tn 
% Row Count 3 (+ 3)
% Row 1
\SetRowColor{white}
while loop & in almost all other cases. \tn 
% Row Count 4 (+ 1)
% Row 2
\SetRowColor{LightBackground}
do-while loop & if you must go through the loop at least once before it makes sense to do the test. \tn 
% Row Count 7 (+ 3)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{x{2.304 cm} x{2.232 cm} x{1.944 cm} p{0.72 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{4}{x{8.4cm}}{\bf\textcolor{white}{ArrayList}}  \tn
% Row 0
\SetRowColor{LightBackground}
\mymulticolumn{4}{x{8.4cm}}{{\bf{Create arraylist:}}} \tn 
% Row Count 1 (+ 1)
% Row 1
\SetRowColor{white}
`ArrayList\textless{}Type\textgreater{}` & `varName = ` & `new ArrayList\textless{}Type\textgreater{}();` &  \tn 
% Row Count 4 (+ 3)
% Row 2
\SetRowColor{LightBackground}
\mymulticolumn{4}{x{8.4cm}}{{\emph{e.g.}}} \tn 
% Row Count 5 (+ 1)
% Row 3
\SetRowColor{white}
`ArrayList\textless{}String\textgreater{} ` & `names = ` & `new ArrayList\textless{}String\textgreater{}();` &  \tn 
% Row Count 8 (+ 3)
% Row 4
\SetRowColor{LightBackground}
Add object to arraylist & \seqsplit{`varName.add(object)`} &  &  \tn 
% Row Count 10 (+ 2)
% Row 5
\SetRowColor{white}
{\emph{e.g.}} & \seqsplit{`names.add("Alice")`} &  &  \tn 
% Row Count 12 (+ 2)
% Row 6
\SetRowColor{LightBackground}
Get size of arraylist: & \seqsplit{`varName.size();`} &  &  \tn 
% Row Count 14 (+ 2)
% Row 7
\SetRowColor{white}
{\emph{e.g.}} & \seqsplit{`names.size();`} &  &  \tn 
% Row Count 16 (+ 2)
% Row 8
\SetRowColor{LightBackground}
Change object with index & \seqsplit{`varName.set(index}, object);` &  &  \tn 
% Row Count 19 (+ 3)
% Row 9
\SetRowColor{white}
{\emph{e.g.}} & \seqsplit{`names.set(0}, "Anna");` &  &  \tn 
% Row Count 21 (+ 2)
% Row 10
\SetRowColor{LightBackground}
Remove object with index & \seqsplit{`varName.remove(index)`} &  &  \tn 
% Row Count 23 (+ 2)
% Row 11
\SetRowColor{white}
{\emph{e.g.}} & \seqsplit{`names.remove(0)`} &  &  \tn 
% Row Count 25 (+ 2)
% Row 12
\SetRowColor{LightBackground}
Passing as a parameter example: & `public static double average(ArrayList\textless{}Integer\textgreater{} x)` &  &  \tn 
% Row Count 30 (+ 5)
\hhline{>{\arrayrulecolor{DarkBackground}}----}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Arrays}}  \tn
% Row 0
\SetRowColor{LightBackground}
Create array: & type{[}{]} varName = new type{[}size{]}; \tn 
% Row Count 2 (+ 2)
% Row 1
\SetRowColor{white}
e.g. & double{[}{]} arr= new double{[}5{]}; //5 objects \tn 
% Row Count 4 (+ 2)
% Row 2
\SetRowColor{LightBackground}
Get length of array: & varName.length \tn 
% Row Count 6 (+ 2)
% Row 3
\SetRowColor{white}
e.g. & arr.length \tn 
% Row Count 7 (+ 1)
% Row 4
\SetRowColor{LightBackground}
Access object with index & varName{[}index{]} \tn 
% Row Count 9 (+ 2)
% Row 5
\SetRowColor{white}
 & arr{[}1{]} \tn 
% Row Count 10 (+ 1)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Reading input}}  \tn
% Row 0
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{8.4cm}}{{\bf{Structure}}} \tn 
% Row Count 1 (+ 1)
% Row 1
\SetRowColor{white}
Import Scanner class: & `import java.util.Scanner;` \tn 
% Row Count 3 (+ 2)
% Row 2
\SetRowColor{LightBackground}
Create a scanner, assign it to a variable: & `Scanner scanner = new \seqsplit{Scanner(System.in);`} \tn 
% Row Count 6 (+ 3)
% Row 3
\SetRowColor{white}
 & `new Scanner(..)` creates a new one \tn 
% Row Count 8 (+ 2)
% Row 4
\SetRowColor{LightBackground}
 & System.in says scanner is to take input from the keyboard \tn 
% Row Count 11 (+ 3)
% Row 5
\SetRowColor{white}
Request user to input number & \seqsplit{`System.out.print("Please} input data: ");` \tn 
% Row Count 14 (+ 3)
% Row 6
\SetRowColor{LightBackground}
Read in number: & `myNumber = scanner.nextInt();` \tn 
% Row Count 16 (+ 2)
% Row 7
\SetRowColor{white}
Read in String & String myString = scanner.nextLine(); \tn 
% Row Count 18 (+ 2)
% Row 8
\SetRowColor{LightBackground}
Read in double & String myDouble = \seqsplit{scanner.nextDouble();} \tn 
% Row Count 20 (+ 2)
% Row 9
\SetRowColor{white}
Read in char: & char myChar = \seqsplit{scanner.next().charAt(0);} \tn 
% Row Count 22 (+ 2)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{p{0.8 cm} p{0.8 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{break statement}}  \tn
% Row 0
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{8.4cm}}{Inside any loop, the break statement will immediately get you out of the loop.} \tn 
% Row Count 2 (+ 2)
% Row 1
\SetRowColor{white}
\mymulticolumn{2}{x{8.4cm}}{If you are in nested loops, break gets you out of the innermost loop} \tn 
% Row Count 4 (+ 2)
% Row 2
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{8.4cm}}{It doesn't make any sense to break out of a loop unconditionally; you should do it only as the result of an if test} \tn 
% Row Count 7 (+ 3)
% Row 3
\SetRowColor{white}
\mymulticolumn{2}{x{8.4cm}}{break should not be the normal way to leave a loop} \tn 
% Row Count 8 (+ 1)
% Row 4
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{8.4cm}}{Use it when necessary, but don't overuse it.} \tn 
% Row Count 9 (+ 1)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{8.4cm}}{Example: \newline  \newline ` for (int i = 1; i \textless{}= 12; i++) \{` \newline `if (badEgg(i))` \newline ` break;` \newline `\}`}  \tn 
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{x{3.44 cm} x{4.56 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Inheritance}}  \tn
% Row 0
\SetRowColor{LightBackground}
subclass (child) & the class that inherits from another class \tn 
% Row Count 2 (+ 2)
% Row 1
\SetRowColor{white}
superclass (parent) & the class being inherited from \tn 
% Row Count 4 (+ 2)
% Row 2
\SetRowColor{LightBackground}
To inherit from a class we use & `extends` \tn 
% Row Count 6 (+ 2)
% Row 3
\SetRowColor{white}
class A extends B & means class A (subclass) inherits attributes and methods from class B(superclass) \tn 
% Row Count 10 (+ 4)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}

\begin{tabularx}{8.4cm}{p{0.8 cm} p{0.8 cm} }
\SetRowColor{DarkBackground}
\mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Polymorphism}}  \tn
% Row 0
\SetRowColor{LightBackground}
\mymulticolumn{2}{x{8.4cm}}{} \tn 
% Row Count 0 (+ 0)
\hhline{>{\arrayrulecolor{DarkBackground}}--}
\end{tabularx}
\par\addvspace{1.3em}


% That's all folks
\end{multicols*}

\end{document}