Data Structure in Java

You are using

import static sun.java2d.cmm.ColorTransform.In;

Which is almost certainly not the right class to use.

I am assuming In was provided as part of your home work. If not you don’t appear to need it, I would just use the Scanner you have already.

Some other points;

  • Using camelCase for field and methods, otherwise String Buffer could be confused with StringBuffer
  • don’t use StringBuffer, as it was replaced by StringBuilder more than ten years ago.
  • Don’t put in redundant ;; and () and this makes readability harder.

  • “% s” is not the same as “%s” in fact you don’t need to format a String as a String as it is a String already. try

    buffer += s;
    

Leave a Comment