I've been having trouble understanding this code that my professor put on the web.
Can someone help me understand this.
I thought this would compile and run but its giving me an error message
" Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at fileio.AllCapsDemo.main(AllCapsDemo.java:64) "
Im not sure how i can fix this problem and actually run this program.
Hi
I've been having trouble understanding this code that my professor put on the web.
Can someone help me understand this.
I thought this would compile and run but its giving me an error message
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at fileio.AllCapsDemo.main(AllCapsDemo.java:64)
Im not sure how i can fix this problem and actually run this program.
The program compiles ok but when you execute it is expecting a command line argument. That argument is a text file containing all the lower-case letters. After run finish, the same file would have all it's contents change to upper-case letters.
javac fileio/AllCapsDemo.java
java fileio.AllCapsDemo <argument in here>
Say we prepare a file called test with lower-case letters inside. We execute like java fileio.AllCapsDemo test
The text file called test will contain all the upper-case letters inside.
Bookmarks