Click here to Skip to main content
15,902,299 members
Home / Discussions / Java
   

Java

 
Questionset database value to java script var on Js file Pin
swapnil666-Feb-12 1:48
swapnil666-Feb-12 1:48 
AnswerRe: set database value to java script var on Js file Pin
David Skelly6-Feb-12 22:12
David Skelly6-Feb-12 22:12 
QuestionRe: set database value to java script var on Js file Pin
swapnil667-Feb-12 22:53
swapnil667-Feb-12 22:53 
QuestionHow to manipulate voice information??????? Pin
Member 86168852-Feb-12 10:28
Member 86168852-Feb-12 10:28 
AnswerRe: How to manipulate voice information??????? Pin
gebri2-Feb-12 21:32
gebri2-Feb-12 21:32 
Questionprint a report sourced by html page Pin
ceyhunerdil1-Feb-12 21:40
ceyhunerdil1-Feb-12 21:40 
AnswerRe: print a report sourced by html page Pin
David Skelly1-Feb-12 22:04
David Skelly1-Feb-12 22:04 
QuestionComparing Strings Reverse if-conditional Pin
johtnkucz1-Feb-12 7:37
johtnkucz1-Feb-12 7:37 
the (inputString == reverseString) if-conditional always returns false (even if it is true. please help. Couldn't figure this out. thanks.

Java
import java.util.Scanner;
public class ReverseString{
	public static void main (String[] args){
	String inputString="";
	int inputStringLength;
	String reverseString="";
	String stringHolder="";
	//String reverseNumString = "";
	
	Scanner in = new Scanner(System.in);
	System.out.print("Enter a String: ");
	inputString = in.next();
	inputStringLength = inputString.length();
	System.out.println("Input String is : " +inputString);
	for (int i = 0; i<inputStringLength; i++){
	stringHolder = inputString.charAt(i) + stringHolder;
	reverseString = stringHolder;
	}
	System.out.println(reverseString);
	System.out.println("inputString = " + inputString);
	System.out.println("input length =" + inputString.length() + "reverse length " +reverseString.length());
	System.out.println("Now let's test to see if your input is a palindrome (like hannah or 'a man, a plan, a canal, panama') \n" + "Does "+ inputString +" = the same forward and reversed? \n^^^ \n^^^ " );
	if (inputString == reverseString){
		System.out.println("yes!");
		System.out.println(" YES!! Eureka!  " + inputString + " == " + reverseString + "!  Thus, " + inputString + " is a palindrome! gratzee!");
	}else {
		System.out.println("no");
		System.out.println("NO!! \n" + inputString + " != (does not equal) " + reverseString + "\n So " + inputString + "is not a palindrome!  Oh well no prob!" );
	}
}//end main
} //end class


I've tried using scaffolding code to test for what is going on. I think someway reverseString is created may be a problem. But when I print reverseString and inputString they both have the same string length and visibly the same characters...so I don't know what the solution is at present.
AnswerRe: Comparing Strings Reverse if-conditional Pin
Richard MacCutchan1-Feb-12 8:58
mveRichard MacCutchan1-Feb-12 8:58 
GeneralRe: Comparing Strings Reverse if-conditional Pin
johtnkucz1-Feb-12 11:40
johtnkucz1-Feb-12 11:40 
GeneralRe: Comparing Strings Reverse if-conditional Pin
Richard MacCutchan1-Feb-12 12:06
mveRichard MacCutchan1-Feb-12 12:06 
GeneralRe: Comparing Strings Reverse if-conditional Pin
johtnkucz1-Feb-12 12:26
johtnkucz1-Feb-12 12:26 
GeneralRe: Comparing Strings Reverse if-conditional Pin
Richard MacCutchan1-Feb-12 22:19
mveRichard MacCutchan1-Feb-12 22:19 
GeneralRe: Comparing Strings Reverse if-conditional Pin
johtnkucz3-Feb-12 4:08
johtnkucz3-Feb-12 4:08 
GeneralRe: Comparing Strings Reverse if-conditional Pin
Richard MacCutchan3-Feb-12 4:35
mveRichard MacCutchan3-Feb-12 4:35 
AnswerRe: Comparing Strings Reverse if-conditional Pin
Dinu_613-Feb-12 22:24
Dinu_613-Feb-12 22:24 
Questionhow to get a value in to JS file from java servlet Pin
swapnil661-Feb-12 7:14
swapnil661-Feb-12 7:14 
AnswerRe: how to get a value in to JS file from java servlet Pin
chakki2921-Feb-12 20:57
chakki2921-Feb-12 20:57 
QuestionHow to displaly progress bar for downloading attachment Pin
R_K1-Feb-12 4:05
R_K1-Feb-12 4:05 
AnswerRe: How to displaly progress bar for downloading attachment Pin
Nagy Vilmos1-Feb-12 6:00
professionalNagy Vilmos1-Feb-12 6:00 
GeneralRe: How to displaly progress bar for downloading attachment Pin
R_K2-Feb-12 1:54
R_K2-Feb-12 1:54 
GeneralRe: How to displaly progress bar for downloading attachment Pin
TorstenH.2-Feb-12 2:42
TorstenH.2-Feb-12 2:42 
GeneralRe: How to displaly progress bar for downloading attachment Pin
R_K6-Feb-12 2:50
R_K6-Feb-12 2:50 
QuestionTWAIN/WIA API for java integration with scanner Pin
graeme.m30-Jan-12 6:44
graeme.m30-Jan-12 6:44 
AnswerRe: TWAIN/WIA API for java integration with scanner Pin
Richard MacCutchan30-Jan-12 8:55
mveRichard MacCutchan30-Jan-12 8:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.