From 1580486eda52a91b206691e5cfff5b8460f2206e Mon Sep 17 00:00:00 2001
From: pjungeblut <paul.jungeblut@gmail.com>
Date: Tue, 25 Nov 2014 23:38:01 +0100
Subject: Josephus Code

---
 java/java.tex | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

(limited to 'java/java.tex')

diff --git a/java/java.tex b/java/java.tex
index 469fcc1..e8e132c 100644
--- a/java/java.tex
+++ b/java/java.tex
@@ -1,18 +1,25 @@
 \section{Java}
+\lstset{language=Java}
 
 \subsection{Introduction}
 
 \begin{itemize}
 \item Compilen: \lstinline{javac main.java}
 \item Ausführen: \lstinline{java main < sample.in}
-\item Einlesen:
-\lstset{language=Java}
+\item Eingabe:
 \begin{lstlisting}
 Scanner in = new Scanner(System.in); //java.util.Scanner
 String line = in.nextLine(); //reads the next line of the input
 int num = in.nextInt(); //reads the next token of the input as an int
 double num2 = in.nextDouble(); //reads the next token of the input as a double
 \end{lstlisting}
+\item Ausgabe:
+\begin{lstlisting}
+//Ausgabe in StringBuilder schreiben und am Ende alles auf einmal ausgeben -> viel schneller
+StringBuilder sb = new StringBuilder(); //java.lang.StringBuilder
+sb.append("Hallo Welt");
+System.out.print(sb.toString());
+\end{lstlisting}
 \end{itemize}
 
 \subsection{BigInteger}
-- 
cgit v1.2.3

