- 1
Java help
I have a java problem who can help me please? Given a queue of integers. Process the queue so that only even items remain in the queue.
5 Answers
+ 1
What is the problem? Link your code so we can see what is going on.
+ 1
LINK the code, that means: Go yo code section, click +, select Java, put your code in there, save.
Come to the threads, click +, sort for My Code Bits, select your code.
0
static public void main(String[] args) {
// Pushing elements into the queue
Queue<Integer> q = new LinkedList<>();
q.add(4);
q.add(5);
q.add(-2);
q.add(-3);
q.add(11);
q.add(10);
q.add(5);
q.add(6);
q.add(8);
if (pairWiseConsecutive(q)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
0
I started to do something but it doesn't respond to the exercise