\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{Welten} \pdfinfo{ /Title (ujcs-ultimate-java.pdf) /Creator (Cheatography) /Author (Welten) /Subject (UJCS | Ultimate Java 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}{00B159} \definecolor{LightBackground}{HTML}{EFFAF4} \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{UJCS | Ultimate Java Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Welten} via \textcolor{DarkBackground}{\uline{cheatography.com/134029/cs/27565/}}} \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}Welten \\ \uline{cheatography.com/welten} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 7th July, 2021.\\ Updated 12th July, 2021.\\ 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{3.08574 cm} x{1.89126 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Java Data Types}} \tn % Row 0 \SetRowColor{LightBackground} byte/short/int/long & 2\textasciicircum{} (8/ 16/ 32/ 64) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} float {[}32bit{]} / double {[}64bit{]} & 1.0f / 1.0d, 1.0 \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} char {[}16bit{]} & "U", "±" \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} String & "Hello World" \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.14011 cm} x{2.83689 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Literals}} \tn % Row 0 \SetRowColor{LightBackground} 2 ⇒ int & 2.0F ⇒ float \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} 2L ⇒ long & 2.0 ; 2.0D ⇒ double \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} "u" ⇒ String & 'u' ⇒ char \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} true ⇒ boolean & false ⇒ boolean \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{number literal modifiers are case-insesitive} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{3.08574 cm} x{1.89126 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Inc- / Decrement}} \tn % Row 0 \SetRowColor{LightBackground} a++ & ++a \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} a-{}- & -{}-a \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} ➜ return a++ / a-{}- & ➜ return a \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Assignment shortcuts: x {\bf{op}}= y \newline Exp: `x += 2;`} \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}{Variables}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{int i = 5, j; \newline int a = 3, b = a + 1; \newline final int c; //=\textgreater{} Constant \newline c = 22; // may be init after} \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}{Comments}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{// Single Line \newline /* Multi Line */ \newline /** Docu String */} \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}{Array}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{int{[}{]} a; //Declaration \newline a = new int{[}5{]} //Dimension \newline int{[}{]} a = new int{[}5{]}; \newline int{[}{]} b = \{10, 20, 30\}; \newline \newline int{[}{]}{[}{]} matrix = new int{[}2{]}{[}3{]};} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Init Values: 0, "\textbackslash{}0", false, null} \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}{Array Methods}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{int{[}{]} a; \newline a.length; //length of array} \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}{ArrayList}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{ArrayList\textless{}Double\textgreater{} nums = new ArrayList\textless{}\textgreater{}(); \newline nums.add(2.3); \newline nums.size() == 1 \newline double a = nums.get(0);} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Like a list in python} \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}{Type Casting}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{int a, b; \newline a = (double) b {\emph{ a //b =\textgreater{} double \newline a = b }} (double) a //a =\textgreater{} double \newline \newline a = (double) (a {\emph{ b) \newline /* (a }} b) will be calculated \newline with int logic then \newline type-casted to double */} \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}{Strings}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{1. Strings are a class in Java. \newline % Row Count 1 (+ 1) 2. Concating is possible without type-cast \newline % Row Count 2 (+ 1) `String a = "Num: " + 5;` \newline % Row Count 3 (+ 1) 3. Parsing:\{\{br\}\} \newline % Row Count 4 (+ 1) `int i = Integer.parseInt("22");` \newline % Row Count 5 (+ 1) `float f = \seqsplit{Float.parseFloat("1.3");`} \newline % Row Count 6 (+ 1) `boolean b = \seqsplit{Boolean.parseBoolean("True");`}% Row Count 7 (+ 1) } \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}{String Functions}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{s.equals(String s2) -\textgreater{} bool} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{s.toLowerCase()} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{s.toUpperCase()} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{s.replace(char old, char new)} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{s.replace(String old, String new)} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{s.indexOf(String s) //-1 if not availabe} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{s.lastIndexOf(String s)} \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{s.split(String delimiter) -\textgreater{} String{[}{]}} \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{all functions return the modified String. They don't modify the original String.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{1.05271 cm} x{2.47158 cm} p{1.05271 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Bitwise Operations}} \tn % Row 0 \SetRowColor{LightBackground} int & boolean & \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} & ! & NOT \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \& & \&\& & AND \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} | & || & OR \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \textasciicircum{} & \textasciicircum{} & XOR \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.64701 cm} x{4.32999 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Biwise Shifts}} \tn % Row 0 \SetRowColor{LightBackground} \textasciitilde{} & Complement \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \textless{}\textless{} & Shift left \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \textgreater{}\textgreater{} & Shift right \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \textgreater{}\textgreater{}\textgreater{} & Shift right Zero fill \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{3.08574 cm} x{1.89126 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Arithmetic Operator Results (+ - * / \% )}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Both Arguments}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} byte, short, int & ⇒ int \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{One, or Both Arguments}}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} long & ⇒ long \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} float & ⇒ float \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} double & ⇒ double \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Examples: `byte * byte ⇒ int; double + float ⇒ double`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{3.53367 cm} x{1.44333 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Java Operations Order}} \tn % Row 0 \SetRowColor{LightBackground} 1. Members & () {[}{]} . \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} 2. Multiplikation & * / \% \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} 3. Addition & + - \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} 4. XOR & \textasciicircum{} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} 5. Logical AND & \&\& \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} 6. Logical OR & || \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{a++, a-{}- counts as 3. Addition \newline `int a = 5, b = 8;` \newline `int c = a * b++ //c is 40;`} \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}{Java Naming Convention}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Constants: \newline % Row Count 1 (+ 1) `MAX, PI, MIN\_TIME` \newline % Row Count 2 (+ 1) Variables, Methods, Packages: \newline % Row Count 3 (+ 1) `xVal, int1Arr, date, showDate` \newline % Row Count 4 (+ 1) Classes: \newline % Row Count 5 (+ 1) `Date, DatabaseHelper`% Row Count 6 (+ 1) } \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}{File IO}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{File file = new File("text.txt"); \newline \newline file.exsits(); \newline file.createNewFile(); \newline file.delete(); \newline \newline BufferdReader = new BufferedReader(file); \newline while ((line = input.readLine()) != null) \{ \newline //statements with line \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{There are other classes, but just use `BufferdReader`} \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}{abstract / Interface}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{abstract Method} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}`public abstract fun();`} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{abstract Class} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}`public abstract class Test\{\}`} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Interface} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Like abstract class, but with only abstract functions. You don't need abstract for these} \tn % Row Count 7 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Abstract Classes and Methods are without implementation. \newline You use `implements` for Interfaces} \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}{UI}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{// Pop-Up Box: \newline import javax.swing.*; \newline String out = \seqsplit{JOptionPane.showInputDialog("Inp:} ");} \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}{Regular Expressions (Regex)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Pattern p = Pattern.compile("\textbackslash{}\textbackslash{}w+"); \newline Matcher m = p.matcher("abc"); \newline \newline while (m.find()) \{ \newline m.group() \newline \} \newline \newline //true if whole string matches \newline m.matches() -\textgreater{} bool} \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}{Bolierplate}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{//{\bf{Syntax for a standalone application in Java:}} \newline class \textless{}classname\textgreater{} \newline \{ \newline public static void main(String args{[}{]}) \{ \newline statements; \newline \seqsplit{————————;} \newline \seqsplit{————————;} \newline \} \newline \}} \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}{Bolierplate cont.}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{{\bf{Steps to run the above application:}} \newline % Row Count 1 (+ 1) \{\{bt\}\} \newline % Row Count 2 (+ 1) 1. Type the program in IntelliJ or notepad. Save the file with a `.java` extension. \newline % Row Count 4 (+ 2) 2. The file name should be the same as the class, which has the main method. \newline % Row Count 6 (+ 2) 3. To compile the program, using javac compiler, type the following on the command line: \newline % Row Count 8 (+ 2) {\emph{Syntax:}} `javac \textless{}filename.java\textgreater{}` \newline % Row Count 9 (+ 1) {\emph{Example:}} `javac abc.java` \newline % Row Count 10 (+ 1) 4. After compilation, run the program using the Java interpreter. \newline % Row Count 12 (+ 2) {\emph{Syntax:}} java \textless{}filaname\textgreater{} (without the .java extension) \newline % Row Count 14 (+ 2) {\emph{Example:}} java abc \newline % Row Count 15 (+ 1) 5. The program output will be displayed on the command line% Row Count 17 (+ 2) } \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}{Java Statements}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{If Statement}} \newline if ( expression ) \{ \newline statements \newline \} else if ( expression ) \{ \newline statements \newline \} else \{ \newline statements \newline \} \newline \newline {\bf{While Loop}} \newline while ( expression ) \{ \newline statements \newline \} \newline \newline {\bf{Do-While Loop}} \newline do \{ \newline statements \newline \} while ( expression ); \newline \newline {\bf{For Loop}} \newline for ( int i = 0; i \textless{} max; ++i) \{ \newline statements \newline \} \newline \newline {\bf{For Each Loop}} \newline for ( vartype var : collection ) \{ \newline statements \newline \} \newline \newline {\bf{Switch Statement}} \newline switch ( expression ) \{ \newline case value: \newline statements \newline break; \newline case value2: \newline statements \newline break; \newline default: \newline statements \newline \} \newline \newline {\bf{Exception Handling}} \newline try \{ \newline statements; \newline \} catch (ExceptionType e1) \{ \newline statements; \newline \} catch (Exception e2) \{ \newline catch-all statements; \newline \} finally \{ \newline statements; \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4977 cm} x{4.4793 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{IntelliJ Emmets}} \tn % Row 0 \SetRowColor{LightBackground} psvm & public static void main(String{[}{]} args) \{\} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} sout & System.out.println(); \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}