Search code examples
javaeclipsevimprintlneclim

Java System.out.print();, behaves different on Eclipse than on Eclim


Im trying to learn some Java, I am using Eclim and after following a tutorial I found that this does not work on Eclim + vim:

class variables{
    public static void main(String args[]){
        double number;
        number = 12.34;
        System.out.print(number);
    }
}

But when I do the same on Eclipse, it does work. The only way I can make it work on Eclim is by using

println

instead of

print

Any ideas on why this would happen??

edit:

Tried this:

class variables{
  public static void main(String args[]){
    double number;
    number = 12.34;
    System.out.flush();
    System.out.print(number);
  }
}

and still nothing. Again, it works on Eclipse, but not on Eclim


Solution

  • use .flush() after .print() because system.out is buffered stream... you'll have to flush the output before you use it.

    In .println(), the output gets flushed automatically