Share your repls and programming experiences

← Back to all posts
Im bad at Java oof
Warhawk947

A project I made for school.

How did this get so many upvotes thanks guys

cheers, warhawk947

Voters
PythonPiboy314
omribashi
Koten
hamur
raf024
MrMinimax
chickendogg
leFrank
Zourbomb
AlexanderTarn
Comments
hotnewtop
Highwayman

Uh. So. I entered 0.
...

Ok.

Yeah.

Warhawk947

@Highwayman yeah if you enter a number smaller or equal to 0 it will print infinite primes

MatthewDoan1

@Warhawk947 Instead of using a while loop, you should check out the for loop: w3schools

Warhawk947

@MatthewDoan1 thanks for the tip, however here I need a while loop because i'm printing a number of primes, not a number of numbers. If I was printing all the numbers from one to ten, i could use a for loop, but i need to print a number of primes, so i need to use a while loop.

MatthewDoan1

@Warhawk947

Warhawk947

@MatthewDoan1 no I'm not doing prime numbers up to a number, I'm doing a number amount of prime numbers (for example if I enter 10 in the project, it won't print out 2, 3, 5, 7. It will print out 2, 3, 5, 7, 11, 13, 17, 23, 29)

Highwayman

@Warhawk947
C++ example because I’m too lazy rn.

This just goes to show that this probably isn’t)t the best idea.
Just my opinion.

Warhawk947

@Highwayman idk if you can do that in java, but you have a point. Thanks!

Highwayman

@Warhawk947 yw? Lol.

Warhawk947

@Highwayman no i'm serious. I didn't know you could do that in java

Highwayman

@Warhawk947 do what?

Warhawk947

@Highwayman only increase the counter variable in a loop if a condition is true

Highwayman

@Warhawk947 oh! Welp. Now you know lol. 😜

Warhawk947
MatthewDoan1

@Warhawk947

AlexanderTarn

"I'm bad at Java"
proceeds to write program at my level

Warhawk947
ravivc
Warhawk947

@ravivc why did I just get this notification lol

Highwayman

@Thecrowbar1234 that name. I aspire to create such amazing program names someday.

[deleted]

XD

LohithS

Warhawk947 (524) you should have used for loop instead of using while loop.

[deleted]

got something similar

[deleted]

I think you are pretty good at Java(compared to me).

Warhawk947

@CodeABC123 thank you!

[deleted]

I can't even code Minecraft! @CodeABC123

MarcosRamirez

@Ganesha1 I dont think thats a bad thing

[deleted]

@MarcosRamirez is right. Minecraft is a complicated game! @Ganesha1

Warhawk947
PythonPiboy314

XD

Warhawk947