how can i add prime numbers and display the final result on java

I assume you can add and display numbers in java.

So, you must be stuck on how to find primes.
There are hundreds of code samples online. The first place to try is always google. I have always found that someone has already done what I want. In this case, here are several approaches:

https://www.baeldung.com/java-generate-prime-numbers