Skip to content

Tag: java

fold not working as expected using akka streams

Below is code I’ve written to try an output the sum of each akka message received which has been edited from this guide : https://doc.akka.io/docs/akka/current/stream/stream-flows-and-basics.html The fold operation seems to cause nothing to outputted on the console. However if I use instead of Then the …

local variable initialization were wrong java [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 months ago. Improve this question I am new to java, why a, b,c initialization are wrong in the following code. Answer Java wo…

Count how many pairs of a number appear in an array

Lets say with the array: I want the output to be: For that I created a Hash table. The code : Not sure what to do next to print out the desired output. Been stuck in this simple part for a long time. Answer The calculation of frequencies seems to be fine, only printing part needs to be addressed. To

Does GlassFish servlet container use that catalina?

I am running the same servlet application in both Apache Tomcat and GlassFish servers. I wanted to see the ServletConfig and ServletContext implementation class names. Surprisingly, I found that GlassFish is also using from Apache Tomcat’s catalina classes. Is my observation correct? If yes, why isn&#82…

How do I add two string elements in vector?

I am new to Java and learning through a task. I have tried to create a program but when I input my name it is raising a InputMismatchException exception. Here is my code: Name.java Answer Your problem is not with vector, it is with scanner methods; you can read this answer, it will give you a good idea about …