blob: 07e0f8351341e609e1f6509b41bc726a9d0d3f75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
\begin{defproblem}{code-helloworld}
This problem has a code fragment.
\begin{onlyproblem}
\lstset{language=Java}
\begin{lstlisting}
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
\end{lstlisting}
\end{onlyproblem}
\begin{onlysolution}
\lstset{language=Java}
\begin{lstlisting}
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello "
+ (args.length==0 ? "anon" : args[0])+"!");
}
}
\end{lstlisting}
\end{onlysolution}
\end{defproblem}
|