Java not getting in expected way

Hi

i am new to java and written a below code on linux platform which is working fine but not getting the output on terminal as expected

 
 vi A.java 
import java.io.FileOutputStream;
class A
{
public static void main (String args[])
{
byte[] c= {'a','e','i','o','u'};
try
{
FileOutputStream b =new FileOutputStream("/home/k");
b.write(65);
b.write(c,1,4);
b.getChannel();
b.close();
System.out.println("success");
System.out.println(b.getChannel());
System.out.println(b.getFD());
}
catch(Exception e)
{
System.out.println(e);
}
}
}
 

here i am getting below Output which is correct

[root@1s home]# cat k
Aeiou[root@1s home]#

but i want output as below. how should i get this. suggest the way forward.

[root@1s home]# cat k
Aeiou
[root@1s home]#

Hint: Your variable names made it hard for me to read your code. Variable names that indicate what they are -- really help. a,b,c,d,e do not convey much.

b.write(c,1,4);

This creates what you see in the file. "\n" works to solve your problem - watch out for windows OS.

So you need another call to write to c with one character, "\n".

Here is a lot more advanced discussion - note that java versions have different limitation on the use of writing to numbered file descriptors - depends on version and OS.
Using a numbered file descriptor from Java - Stack Overflow