?
Solved

Conditional processing using parameters

Posted on 2003-03-04
1
Medium Priority
?
202 Views
Last Modified: 2010-05-18
This has to be one of the simplest questions around!

I am completely new to Java and am attempting to manipulate some free source code.

I am trying to implement some basic logic like this:

theString = getParameter("theString")

if (theString == "aValuePassedIn") // perform next step
else // perform alternative step

Once compiled, the script never seems to make a match with the parameter value. I have tried strings, empty strings and integers, to no avail.

0
Comment
Question by:russback
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 86

Accepted Solution

by:
CEHJ earned 150 total points
ID: 8064376
if (theString == "aValuePassedIn") // perform next step

should be

if (theString.equals("aValuePassedIn") )// perform next step

else your code is comparing object references, which is not the same thing
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month12 days, 5 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question