aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
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: 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
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: 39415
    
  28
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: 39415
    
  28
This thread looks to me like a duplicate of the last question here, so I shall close it.
 
jQuery in Action, 2nd edition
 
subject: Program Help