-1
votes
1answer
37 views

If statement wont recognize string [duplicate]

I have an if statement that takes a string, and if another string has the same value as that string do 1 thing, and if the variable doesnt equal that string do another thring here is my code if(Pos ...
0
votes
2answers
80 views

How do I declare String from result of IF Statement?

I have been playing around and testing out some of the stuff I learned, and this isn't working for me for some reason. It's only mid-app, but I keep running it during development to make not have a ...
2
votes
4answers
107 views

C++ if statements using strings not working as intended

I have searched for this error but noone seems to be having the same problem as me. I am trying to make a basic text based RPG game in C++ to learn, and I want the user to be able to type what they ...
0
votes
0answers
46 views

Using strings with if statements

I have this code: public UILabel Error; void OnRegister(GameObject g) { if (Error.text.Equals("That e-mail address is in use. Use password recovery if you forgot your password.")) { ...
1
vote
1answer
73 views

If statement on string wont work

Hello so im working on an app for windows(C#) and android(Java) that the two communicate through TCP and i have got them both sending each other strings but when i want to see if the received string ...
0
votes
1answer
24 views

Running a class within a class

String ans = JOptionPane.showInputDialog(null, "S,T,R,K or P?"); if (ans == "S") { class Square } Basically, I'd like to run this exert of code under a main class Shapes, and then in the if ...
4
votes
2answers
49 views

Why is if-else for String faster than switch-case for enum?

As Java 6 does not have switch-case for String, I often change an if-else block to switch-case using enum as in the code below. However, when I tried to check the performance of the two alternatives, ...
0
votes
7answers
127 views

if else code blocks … or one if with multiple OR ( | |) conditions within it ? in C

I was writing a small text matching program in C, which basically checks for the presence of a few characters in some strings (in form of char arrays). Its working now and I have a code block like ...
1
vote
1answer
18 views

android - string doesnt set off if condition but log output suggests it should

So im making an app that uses sms to send data between two devices and am trying to get one to automaticly respond to the other. But the string getMessageBody() is returning isnt setting of the if ...
2
votes
6answers
75 views

Can I create an OR statement when comparing strings?

My code is: import java.util.Scanner; class mainClass { public static void main (String [] args) { secondaryClass SCO = new secondaryClass(); Scanner scanner ...
3
votes
4answers
100 views

How to use an Array with an If statement

I am new to Java. I'm not really sure how to effectively use an array in Java. I may not be able to use the correct terms so I will attempt to show you in code. Basically, this is my array. int[] ...
-10
votes
4answers
85 views

Comparing outcome for a string and array in IF statement? [closed]

Is is possible to compare the values of the array to the values a user inputs? String [] Array = {"1", "2", "31"}; //The array String value= Integer.parseInt(textField.getText()); //the String if ...
1
vote
1answer
46 views

If Statements are not working for JTexfield & String Comparison

This is my code public Main_panel() { initComponents(); setLocationRelativeTo(null); tf_type.setVisible(false); String normal = tf_type.getText(); String ntext = "normal"; ...
0
votes
2answers
49 views

How to analyze a string in java to make sure that it has both letters and numbers? [closed]

I need to analyze a string in JAVA to find out if it has both letters and numbers. So this is what I have so far. The variable pass is a String of maximum 8 characters/numbers that is inputted by the ...
0
votes
1answer
28 views

Why isnt multiple else if statements not working to create flot graph?

if(options == verticlebar_graph ){ plot(plotname, plotdata, verticlebar_options); } else if(options == linechart_graph){ plot(plotname, plotdata, linechart_options); } else if(options == pie_graph){ ...

1 2 3 4 5 15
15 30 50 per page