# lstlistings works strangely

I have some Java source code and want to display it in LaTex:

\lstset{language=Java}
\begin{lstlisting}
IntentFileter intentfilter = new IntentFilter();
g = new blm(this, null);
\end{lstlisting}


But the output is indeed ugly:

Did I do something wrong or this is what it ought to be?

-

This may serve to be a starting point towards procrastination and beautification:

\documentclass{article}
\usepackage{listings}
\usepackage{xcolor}

\lstset{language=Java,
basicstyle=\footnotesize\ttfamily,
stringstyle=\ttfamily,
showstringspaces=false,
breaklines=true,
frameround=ffff,
frame=single,
rulecolor=\color{black},
tabsize=1,
keywordstyle=\color{red}\bfseries,
columns=fullflexible,
morekeywords={public, class}
}

\begin{document}
\begin{lstlisting}
IntentFileter intentfilter = new IntentFilter();
g = new blm(this, null);

You can customise further using the directives inside \lstset. For details, refer to listings manual. For extreme beautification, you may use tcolobox with its listings only option. Search for tcblisting in tcolorbox documentation.
@Elderry Not choosing a monospace font by default was a precise choice made by the package author, who was apparently fond of listings in normal type. I usually add also columns=fullflexible to avoid spaced letters. –  egreg Mar 7 at 9:56
Instead of keywordstyle=\color{red}\bf, you could put keywordstyle=\color{red}\bfseries, to get bold monospaced letters if available (unless you DID want that output). –  Manuel Mar 7 at 10:07