All Questions
769
questions
-1
votes
1
answer
99
views
groovy find operator produce java.io.NotSerializableException: java.util.regex.Matcher
Im working in a pipeline with groovy and I found this problem with find operator where all solutions didn't work.
after this code:
stage('Get build artifacts') {
def buildNumber = (params....
-2
votes
1
answer
60
views
Why is my or operator not working in my while loop [duplicate]
Im trying to use an or operator the the parameters of my while loop and its not working.
import javax.swing.JOptionPane;
public class Checkpoint203P5 {
public static void main(String[] args){
...
0
votes
1
answer
331
views
I do not understand how {int a=10; a+=++a-5/3+6*a; System.out.print(a);} outputs 86
I do not understand how
{
int a = 10;
a += ++a-5/3+6*a;
System.out.print(a);
}
outputs 86
I know that shorthand notation has lower precedence than any of the operator used here so my ...
0
votes
1
answer
45
views
Why I not am getting desired result while using == to compare elements of two SORTED arraylist [duplicate]
I want Make a new Arraylist of the common element from Two SORTED ARRAYLIST list1 and list2
I use "==" operator and got wrong answer the I used ".equals()" operator and got ...
1
vote
2
answers
102
views
Parentheses and Unary Operator Precedence in Java
As per the order of precedence of operators, () is evaluated before unary operators like ++ or --. But let us consider the following code:-
int x = 1;
x = 2 + (x++);
If x++ is executed first, the ...
1
vote
2
answers
71
views
Generating random equations with wrong answers ( operator precedence problem )
I am trying to generate a random Equation and an answer to it.
Everything works fine, except the answers are being calculated wrong ( without consideration of operator precedence ). I've been trying ...
0
votes
0
answers
38
views
I'm confused why this code reverses the order of the account and the result comes out different [duplicate]
class Result {
public static void solve(double meal_cost, int tip_percent, int tax_percent) {
double tax=(meal_cost*tax_percent)/100;
double tip=(meal_cost*tip_percent)/100;
...
0
votes
0
answers
325
views
Creating a Java program for a budget
I'm trying to create a java program in netbeans for a simple budget that will include 2 multiplication and 1 addition operators. I need it to accept three different amount put in by the user. Right ...
0
votes
1
answer
62
views
Java program using remainder operators
I'm trying to create a java program in netbeans that will accept two integers and return a message is the first integer is a multiple of the second. So "integer1 is a multiple of integer2" ...
2
votes
1
answer
379
views
Java calculator (order of operations)
How do you tell Java the order of operands?
Well, I am pretty new to coding and a friend of mine in a higher course got asked to make a calculator and I got interested in how would it would work.
I ...
-1
votes
1
answer
219
views
Not getting the satisfactory output. why?
Im new to java.. and after writing a code im getting a solution which was unexpected from my side. Please guide me why my output isnt 5 , 5 ?
I had written a code -
import java.util.*;
public class ...
0
votes
2
answers
194
views
operator '&&'cannot be applied to 'int', 'int' [closed]
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode = 1 && ...
0
votes
1
answer
59
views
Validate combination of codes with clause operators
First of all, I'm sorry this question may sound easy, but I'm not a real programmer, just a hobbyist.
I have a problem I can't get around solving how to program following thing in any available ...
0
votes
2
answers
119
views
How does Java handle precedence of operators when unary operators are involved?
I have the following code in Java :
int a=5,b=10,c;
c = ++b * ++a - a++ ;
System.out.println(c);
Now referring to the Java operators precedence table :-
Table
We will first evaluate the postfix a++ ...
-3
votes
1
answer
471
views
How to do Salary >= 10000 && Salary <= 20000
So heres my code:
public class employee {
//attributes
String Name = "name";
String Position = "position";
//behavior
public static char getSalary(int Salary) ...