Chuyên mục

Java Exponents

Rate this post

Free preview of my Java course:

I recommend installing Tabnine autocomplete on your IDE (free):

This is the exact code you need to calculate exponents in java! ✅ Simply write Math.pow(a, b) and replace with the numbers you want.

👑Start practicing now with 10 free java programs –
🌅 Source Code –

“a” is your base and “b” is your exponent. For example, 5^2 would be Math.pow(5, 2); Put that in a print statement like this: System.out.println(5 + 10); and you will see the addition printed to the screen.

This format of calculating java exponents can be tricky… They should just have a symbol for it! But Math pow isn’t too bad 🙂 If you followed along, congrats! You learned-by-doing!

I hope you enjoyed this tutorial on java exponents! I like to have a nice mix of tutorials and actual projects for you all 🙂

Do you want to learn how to code from scratch, in Java? Check out my Java Tutorial For Beginners:

What are you using exponents in java for? –

Free tips and programs:
Programmer Humor: – Promo code: “ALEX10” for 10% off

Recommended Channels to Subscribe to
Career Karma:


(2nd channel)

Alex Lee

Tag: pow in java, exponents in java, calculating exponents in java, how to do exponents in java, how to calculate exponents in java, exponent in java, exponent method in java, how to make exponents in java, java exponents method, java exponent method, java exponent, java exponents, math pow java, math pow java meaning, java exponents tutorial, java, math.pow, math.pow in java, alex lee, alex lee java

Xem thêm:


41 trả lời trong “Java Exponents”

Why can I store math.pow in an
integer variable inside a for loop like this:

Int number = 0;

number += Math.pow(2,2) inside a for loop.

the code will run! But when I rewrite the code to:
number = number + Math.pow(2,2);

the code wont run bc I cant convert double to int. Somebody pls explain

I am from India and I like the way u teach every concept . Just after my java class I always prefer to watch ur videos to make myself more satisfied and concepts .
It's a humble request to u to make more content on java questions of competitive level . Please make promise of it!
Sending Love to u from India ! ❣️❣️🌼🌼💞💌

can someone help me figure out why, in the project explore window on the left side of eclipse, my project folder icons have a little yellow warning icon? i had a red x icon on them and figured out my JRE was setup wrong or something, fixed that. now theres the yellow exclaimation point icon. i see in the example video you have several of these warnings in your folders. what do they mean? why are they there? can i fix it? will it stop things from working? i dont get why anyone uses eclipse at this point, intelliJ is so much more user friendly but ive heard eclipse is what the pro companies use for whatever reason.

Hey Alex Lee, I would really suggest making a video on all Math Library Functions.
Though I know them, they Might be helpful for others.

Functions like-
1-Math.pow() — (You already did this in this video)

And Just Incase you do not know them… (There is a 99.99% chance you know them cuz well… you are Alex Lee!)
I could help you with it. 😉

Good luck with your channel!
I will get my friends to sub to you! 🙂

Trả lời

Email của bạn sẽ không được hiển thị công khai.