ch11 7. Package Hyphen .docx - \/Author Jay Baraki package hyphen import public class Hyphen cfw public static void main(String args cfw int i

ch11 7. Package Hyphen .docx - /Author Jay Baraki package...

This preview shows page 1 - 2 out of 2 pages.

//Author Jay Baraki package hyphen; import*; public class Hyphen { public static void main(String[] args) { int i; FileInputStream fin = null; FileOutputStream fout = null; //1st both files are specified if(args.length !=2){ System.out.println("Usage: Hyphen From To"); return; } //copy file and substitute hyphens try { fin = new FileInputStream(args[0]); fout = new FileOutputStream(args[1]); do{ i =; //convert space to hyphen
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

Unformatted text preview: if ((char)i == ' ') i = '-'; if(i != -1) fout.write(i); } while (i != -1); } catch (IOException exc){ System.out.println("I/O Error: " + exc); } finally { try { if(fin != null) fin.close(); } catch(IOException exc){ System.out.println("Error closing input file."); } try { if(fin != null) fout.close(); } catch(IOException exc){ System.out.println("Error closing output file."); } } } }...
View Full Document

  • Spring '08
  • Garcia,D
  • Void type, Hyphen, IOException exc, Jay Baraki, public class Hyphen

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors