File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Program Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Program Help" Watch "Program Help" New topic

Program Help

Adam Stever

Joined: Jul 23, 2012
Posts: 9
I am posting a program that needs some obvious attention, My goal here is to prompt the user wether they would like to encrypt or decrypt their file and obviously just incement by 1, Please help.

John Jai

Joined: May 31, 2011
Posts: 1776
Please TellTheDetails. What are the errors you are facing?

One obvious error is you have declared fileName as a String variable, but you try to use it as an array.
Michael Krimgen
Ranch Hand

Joined: Jul 08, 2012
Posts: 35

I am not sure what exactly your program is supposed to do, so it would be good to have an explanation.

However, the following part of your code looks rather odd to me:

I have some doubts that it does what you intend it should do.

1) You have semicolons after the if and else, which in fact represent an empty statement. The following blocks in curly brackets will always be executed.
2) if (fileName [i] = ch) is an assignment, not a condition

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46437
Well done picking up the extra semicolons. I think that block won’t even complete since the else is separated from its if by the semicolons.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46437
This thread looks to me like a duplicate of the last question here, so I shall close it.
I agree. Here's the link:
subject: Program Help
It's not a secret anymore!