0
votes
3answers
87 views

Trouble with using a simple boolean [closed]

Sorry if this is a stupid question, but Im completely new to this and just trying my hand. My code is stuck....after this point, the program ends, no matter whether a 1 or 2 is selected. I know its ...
-3
votes
1answer
40 views

And operators usage of && and !== in java

This is my first time looking into java and I'm trying to make this statement work. [if {(a) && (b) && (c) && (d)}!==0] {a}{b}{c}{d} Asssuming a b c d were all numbers ...
0
votes
4answers
26 views

Issue With Value Comparison in Sort

I'm playing with ArrayList class methods and such in a separate .java file as I continue to work on a highscores feature. Now, it suits my purposes to have two equal scores arranged such that the ...
1
vote
3answers
45 views

Need to understand this line of Java using the ? conditional operator

I'm currently working on a project and came across a couple lines of code like this: List<Map<Sring, ? super Serializable>> list = new ArrayList<Map<String, ? super ...
0
votes
1answer
21 views

Issue Incrementing a Value Inside an ActionListener

I'm trying to increment/decrement a user score as appropriate inside a text field on a (very) basic GUI. How, I only succeed in decrementing even though there is proof my conditional works correctly. ...
-2
votes
1answer
38 views

Conditional is a variable that increments processing java [closed]

I need to make a condition that rest the value of an integral by the increment of an arraylist size. This is what I have if(pintables.size()%1==0) { alfa-=4; } if(alfa<0) { alfa=0; } Every ...
0
votes
3answers
43 views

Declaring a variable and its type in a conditional statement

I'm trying to do this in Java: if(this.ssl == true) { HttpsURLConnection connection = (HttpsURLConnection) new URL(address).openConnection(); } else { HttpURLConnection connection = ...
1
vote
1answer
41 views

JAXB conditioned binding

i have a class like : @XmlRootElement Class ClassA { public long objectId; public String status; public String property1; ...... } and i want JAXB's JSON output to be conditioned on property ...
3
votes
1answer
94 views

If x of y values are equivalent

If I have 5 integers (a,b,c,d,e) what is the shortest way I can check if at least 3 of them are equivalent. ex. a==1 b==1 c==2 d==3 e==4 //returns false ex. a==1 b==1 c==1 d==3 e==4 //returns true ...
1
vote
5answers
100 views

Java: If condition only being checked once

I'm trying to create a simple Android app in Java with the following code: public class MainActivity extends Activity { //Declare variables boolean first = true; boolean secondorbefore = ...
0
votes
2answers
60 views

Java conditional checks and assignment

I am looking for a more efficient way to perform the following action, where I am appending the return value of a method to an array. However if the return is null i want to perform another action and ...
4
votes
3answers
93 views

What is the purpose of “return methodA() || methodB()” in Java

I found this code snippet in a program I'm looking at, can someone explain what's going on here? return methodA() || methodB(); methodA and methodB eventually return booleans. Is this some kind of ...
-1
votes
4answers
140 views

Java, multiple operators in conditional statement [closed]

I am fairly new to java and i'm trying to write this simple program to calculate the cost of admission for single and multiple employees. this is the error message im getting about the operators in ...
1
vote
4answers
105 views

Conditional assignment for an ArrayList

I'm trying to deal with a number of different cases in my code dependent on attributes pulled from the HTTPRequest object. The thing is, different data gets pulled to fill the ArrayList dependent on ...
-6
votes
3answers
238 views

Conditional operator vs if then else [closed]

If I want to implement some conditional code that can be implemented in both of the ways. Then which way is better conditional operator ?: or if..then..else??

1 2 3 4 5
15 30 50 per page