This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Program Help Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Program Help" Watch "Program Help" New topic
Author

Program Help

Adam Stever
Greenhorn

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
Bartender

Joined: May 31, 2011
Posts: 1778
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: 34
Hi,

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
Sheriff

Joined: Oct 13, 2005
Posts: 32692
    
    4
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
Sheriff

Joined: Oct 13, 2005
Posts: 32692
    
    4
This thread looks to me like a duplicate of the last question here, so I shall close it.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Program Help
 
Similar Threads
File encryption / decryption retaining line feeds
Java Encrypt and decrypt file
Program mod w/o command line arguments
java application using swing
Need help writing star pattern to file