Java Math class 📐【6 minutes】

  Рет қаралды 106,864

Bro Code

Bro Code

Күн бұрын

Пікірлер: 179
@BroCodez
@BroCodez 3 жыл бұрын
import java.util.Scanner; public class Main { public static void main(String[] args) { double x; double y; double z; Scanner scanner = new Scanner(System.in); System.out.println("Enter side x: "); x = scanner.nextDouble(); System.out.println("Enter side y: "); y = scanner.nextDouble(); z = Math.sqrt((x*x)+(y*y)); System.out.println("The hypotenuse is : "+z); scanner.close(); } }
@Doscoorn
@Doscoorn 2 жыл бұрын
e
@francoiszamora3552
@francoiszamora3552 2 жыл бұрын
Hh
@dapianoman20
@dapianoman20 2 жыл бұрын
import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { double x; double y; double z; x = Double.parseDouble(JOptionPane.showInputDialog(null,"What is side x?")); y = Double.parseDouble(JOptionPane.showInputDialog(null,"What is side y?")); z = Math.sqrt((x*x)+(y*y)); JOptionPane.showMessageDialog(null,"Side z is "+z); } } I decided to try writing the same program by myself but using the GUI from the last lesson to see how well I understood all of the concepts taught so far. Worked well. Thanks Bro! :D
@felexsabu2562
@felexsabu2562 Жыл бұрын
@Bro Code Hey bro in 4:13 you type x but dont precede it with String. Is it ok to write a variable without adding its class. I just want to understand the reason of where one should add class.
@andersburon1216
@andersburon1216 Жыл бұрын
i tried combining with the previous lesson to spice it up: import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { double x = Double.parseDouble(JOptionPane.showInputDialog("Enter side x: ")); double y = Double.parseDouble(JOptionPane.showInputDialog("Enter side y: ")); double z; z = Math.sqrt((x*x)+(y*y)); JOptionPane.showMessageDialog(null, "The hypotenuse is: "+z); } }
@eshaanjames4319
@eshaanjames4319 2 жыл бұрын
First of all his videos are direct to point ... no bullshit Then his voice is so soothing Explains everything really smoothly Then lastly Better than paid courses... He values out time.. everthing is point to point Great work Bro Keep growing Love from India
@abdalle3483
@abdalle3483 3 жыл бұрын
Wow, this series is better than paid ones. thank you Boss a lot
@BroCodez
@BroCodez 3 жыл бұрын
thanks for watching Abdalle
@Golosovtalks
@Golosovtalks 2 жыл бұрын
I wasn't able to find anything useful in russian segment of youtube about java, so i made up my mind to look for something in english segment and i came across with you. i don't figure out almost 20-30 % of your speaking, buy you turned out more useful and informative than those guys) thanks great for your extremely hard work)
@momomomo-lt5fs
@momomomo-lt5fs 2 жыл бұрын
I'm a total beginner, I'm a career shifter, and I need to learn java. Thanks for this series I hope to learn what I need for java from this and so far it's very easy to understand concepts
@sutofana
@sutofana Жыл бұрын
hey,how is your career shifting going?
@reflex3717
@reflex3717 8 ай бұрын
​@@sutofanahe fucked up
@perezkirvygian9725
@perezkirvygian9725 2 ай бұрын
I'm 16 years old right now, and I just learned the fundamentals of coding from another video to understand some of the terms ahead of time. I can say that it really helps when you explain things directly to the point. I've made a basic calculator for addition, multiplication, etc. (although I don't know how to combine all of them yet) just based on the lessons you taught on GUI introduction, arithmetic expressions, and user input. I just wanted to thank you for making this video. It's really helpful, coming from a guy in 2024.
@omersond4891
@omersond4891 3 жыл бұрын
i am not bored to watch and comment your videos. and smash the like button every time with a "detroit smash"
@BroCodez
@BroCodez 3 жыл бұрын
United States of Smash! 👊
@omersond4891
@omersond4891 3 жыл бұрын
@@BroCodez awersome xD
@MrViutiful
@MrViutiful 3 жыл бұрын
Thanks for the explanation. Very easy but very useful for a beginner like myself.
@BroCodez
@BroCodez 3 жыл бұрын
thanks for watching Vitor
@thenickolau5542
@thenickolau5542 2 жыл бұрын
You can also replace z value with Math.hypot(x, y) method (Java16). Thx for the vids, doing full course, pretty awesome so far!
@ilanshlain8819
@ilanshlain8819 3 жыл бұрын
Hey bro! I used what I learned from your GUI video and made this program into a GUI! import javax.swing.JOptionPane; public class Main { public static void main(String[] args){ double x; double y; double z; x = Double.parseDouble(JOptionPane.showInputDialog("Enter in size for side x")); //This is for side x. y = Double.parseDouble(JOptionPane.showInputDialog("Enter in size for side y")); //This is for side y. z = Math.sqrt((x*x) + (y*y)); JOptionPane.showMessageDialog(null, "The hypotenuse for your triangle is " + z); //This is for the hypotenuse. } } Thanks so much bro for making programming so much more enjoyable!
@Daddy_D96
@Daddy_D96 Жыл бұрын
Tried the same, thanks for the help.
@pavelkvasnicka6856
@pavelkvasnicka6856 Жыл бұрын
This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro
@yrtech-pk2lz
@yrtech-pk2lz 2 ай бұрын
I am a junior beginner. Sir thank you for this I learn a lot.
@munawaraliaraiz8760
@munawaraliaraiz8760 3 жыл бұрын
Best playlist for beginners...❤️ Love ur videos Bro
@bagyu333
@bagyu333 3 жыл бұрын
Or you can play with an other math method Math.pow: import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { double a = Double.parseDouble(JOptionPane.showInputDialog("Enter side 'a': ")); double b = Double.parseDouble(JOptionPane.showInputDialog("Enter side 'b': ")); double c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2)); JOptionPane.showMessageDialog(null, "The hypotenuse is: " + c); } }
@stefan5450
@stefan5450 3 жыл бұрын
I've always wanted to be able to calculate the hypotenuse of a triangle. Thx.
@jayarm.serrano1839
@jayarm.serrano1839 10 ай бұрын
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double p; double b; double h; System.out.println("Enter base: "); b = sc.nextDouble(); b = Math.pow(b, 2); System.out.println("Enter perpendicular: "); p = sc.nextDouble(); p = Math.pow(p, 2); h = b + p; h = Math.sqrt(h); System.out.println(h + "inches"); sc.close(); } } I paused the video and tried to solve the problem by myself and this what I've done. Different code but both giving the same results. Hoping that soon I can make a more efficient code like yours. BTW, I just started learning java and my dream is to be come a software dev 😅 ps: your video tutorials really helping me a lot. thankyou so much!
@IceBeam93
@IceBeam93 3 жыл бұрын
Thank you so much for these tutorials. Just to give you a hint why you cant get an answer of -10 as a root is because it is a negative number!
@jilllin9776
@jilllin9776 2 жыл бұрын
Thank you for making the series video for the beginner. That's really helpful.
@ChristianRodriguez-tm3jg
@ChristianRodriguez-tm3jg 4 ай бұрын
You are really good at programming
@jazbaliola7340
@jazbaliola7340 2 жыл бұрын
Bro you're so fun to watch you make learning fun! Thank you.
@danielbrachman
@danielbrachman 10 ай бұрын
love your teaching style!
@JamaicaAmor-o1u
@JamaicaAmor-o1u Жыл бұрын
I really do appreciate your sample program very big help for me.... thank you sooooo much
@ari_james_dio9090
@ari_james_dio9090 Жыл бұрын
Most math gifted programmer
@nerochan4094
@nerochan4094 2 жыл бұрын
this is after GUI class, I tried this while using GUI! 🤩 Thankyou very much BRO!
@honoredegg
@honoredegg 2 жыл бұрын
7th. So you can use numbers to instantiate them with the Math function (round, floor, ceil, sqrt, abs, min, max). Thank you, ma Bro Sensei!
@stanislavdimitrov1643
@stanislavdimitrov1643 Жыл бұрын
I am starting to like your videos. Cheers:)
@parsamousavi7726
@parsamousavi7726 2 жыл бұрын
im subbed on 3 different accounts thats how good this channel is
@BroCodez
@BroCodez 2 жыл бұрын
Hero!
@rashedulislamsunny9218
@rashedulislamsunny9218 Жыл бұрын
thanks for helping me for my final year project thank you bro!
@juliuspiloton9846
@juliuspiloton9846 Жыл бұрын
Thank you! Simple and easy to understand
@saikrishnakarra5472
@saikrishnakarra5472 3 жыл бұрын
Bro you are the best indeed. Subscribed to the channel!!!
@cameronstout1728
@cameronstout1728 5 ай бұрын
Wonderful as always!
@Olympheus
@Olympheus Жыл бұрын
Thank You Bro. You are a life saver.
@JuliHoffman
@JuliHoffman 2 жыл бұрын
WOW!!! I wish I'd had this in school!!! You rock!!!!!!!!!!!!!!!!!!!!
@honoredegg
@honoredegg 2 жыл бұрын
You deserve more likes. Subscribed.
@wallstreetbets7741
@wallstreetbets7741 2 жыл бұрын
I learnt again from you as always thanks Bro
@chitzuru3467
@chitzuru3467 4 ай бұрын
I'm 3 years late to witness this masterpiece
@ranasaani
@ranasaani Жыл бұрын
Thanks for sharing this.
@itlogskina
@itlogskina 3 жыл бұрын
Thank you
@Suraj-rv2dt
@Suraj-rv2dt Жыл бұрын
You are great 👍 I am from India 🇮🇳
@AliiaAbdieva
@AliiaAbdieva Жыл бұрын
great job thanks
@muhammadmushfiqurrahman1653
@muhammadmushfiqurrahman1653 2 жыл бұрын
Thanks bro for your useful tutorial.
@StandProudYouAreStrong
@StandProudYouAreStrong Жыл бұрын
Thank you bro :*
@RahmatullahVahdatWithCod-pl2vh
@RahmatullahVahdatWithCod-pl2vh 2 ай бұрын
wow wow brother thank You
@bartomiejsniadach5795
@bartomiejsniadach5795 2 жыл бұрын
another easy one. Thank you
@Simis999
@Simis999 2 жыл бұрын
Nice sides you picked bro
@deltakelp3468
@deltakelp3468 2 жыл бұрын
I'm getting this "The method sqrt(double) in udefined for the type Math" Even if I use your code. I don't really understand what is the problem. Edit: So I used "java.lang.Math.sqrt" instead of just "Math.sqrt" and it works
@filthipina
@filthipina 11 ай бұрын
thank you, you are an angel 😇
@bekturasanbekov1979
@bekturasanbekov1979 Жыл бұрын
Thx for video Bro!
@haymig8457
@haymig8457 Жыл бұрын
Great guy 🙏🙏🙏
@duxxgd2733
@duxxgd2733 11 ай бұрын
this is awesome dude
@HavocMusic1759
@HavocMusic1759 3 жыл бұрын
I made a cleaner version with GUI. package learning; import javax.swing.JOptionPane; public class Learning { public static void main(String[] args) { double x = Double.parseDouble(JOptionPane.showInputDialog("Enter Side X:")); double y = Double.parseDouble(JOptionPane.showInputDialog("Enter Side Y:")); System.out.println("printing answer"); double z = Math.sqrt((x*x)+(y*y)); JOptionPane.showMessageDialog(null, "The hypotenuse of this triangle is "+z); System.out.println("printed"); } } thank you because I wouldn't of done that without you!
@abhinavshesware9122
@abhinavshesware9122 Жыл бұрын
Learned a lot from you compared to other paid courses. Thank you BIG BRO CODE..
@bananinator2502
@bananinator2502 Жыл бұрын
thx for the free tutorials
@rivalahmad9923
@rivalahmad9923 3 жыл бұрын
thanks bro
@ibrahimylmaz8378
@ibrahimylmaz8378 2 жыл бұрын
you are amazing!
@hoanginh1437
@hoanginh1437 2 ай бұрын
the abs one got me haha
@dy_IAN
@dy_IAN 5 ай бұрын
You boss, you saved me.
@AmberShah786
@AmberShah786 2 жыл бұрын
Thank you bro
@Horatius_23
@Horatius_23 2 жыл бұрын
thanks! :D
@grozageorge2887
@grozageorge2887 Жыл бұрын
Thanks 😇
@beom8285
@beom8285 Жыл бұрын
The best!!
@explodingrubberducky797
@explodingrubberducky797 2 жыл бұрын
great channel. Wish there was an sql course or something.
@cesara9747
@cesara9747 2 жыл бұрын
awesome!
@Ramkumar-uj9fo
@Ramkumar-uj9fo 4 ай бұрын
Core java math Basic Arithmetic (operators) Relational and Logical Operators Bitwise Operators Math Class Functions (limited trigonometry) Sets (through collections framework) Optimization (Queue and Scheduler and Threads) Calculus (Streams) Combinatorics (List Vectors ArrayList) Abstract Algebra (HashMaps) Java people were struggling with matrices. --- It is max Tegmark (mathematical universe) or Stephen Wolfram (Ruliad)
@chainsaw_dog
@chainsaw_dog Ай бұрын
Thanks
@trickysachin
@trickysachin 2 жыл бұрын
Nice 👍😊😊😊
@pratikkandalgaonkar4843
@pratikkandalgaonkar4843 2 жыл бұрын
Thanks bro!!!!!
@sairos4057
@sairos4057 2 жыл бұрын
ty bro
@PoorwayTraning
@PoorwayTraning Жыл бұрын
thanks
@javierpesaresi311
@javierpesaresi311 Жыл бұрын
Fantastic-oooou!
@rufatalizada4006
@rufatalizada4006 2 жыл бұрын
Thanks Bro!
@user-gj3uh8rs3e
@user-gj3uh8rs3e 11 ай бұрын
awesome
@prabhjotsingh8908
@prabhjotsingh8908 3 жыл бұрын
Awesome.!
@yrtech-pk2lz
@yrtech-pk2lz 2 ай бұрын
Sir ,is 1.)double y = -10.0 ; 2.) double y = -10 ; Sir 1 or two correct sir 2:29
@greeneggsandmushrooms9855
@greeneggsandmushrooms9855 3 жыл бұрын
m + a + t + h = math
@shahnewazish
@shahnewazish Жыл бұрын
Great
@huuloc8719
@huuloc8719 2 жыл бұрын
Nice.
@EAGBADEHC
@EAGBADEHC Жыл бұрын
nice
@deltakelp3468
@deltakelp3468 2 жыл бұрын
I'm getting this "The method sqrt(double) in udefined for the type Math" Even if I use your code. I don't really understand what is the problem.
@Giovanni-Rhonim
@Giovanni-Rhonim 7 ай бұрын
God Bless you Bro +4
@trypwyre9024
@trypwyre9024 2 жыл бұрын
So we need to import math modules? because the functions like sqrt, abs, and max-min don't work, please advise!
@johnnymartin3911
@johnnymartin3911 2 жыл бұрын
You shouldn't need to import anything Math.something, is the M in Math capitalized?
@trypwyre9024
@trypwyre9024 2 жыл бұрын
@@johnnymartin3911 no it was just a glitch in the whole application solved by reinstalling.
@yashkr4137
@yashkr4137 2 ай бұрын
Hello Mr. Bro, my IDE always gets errors even if I do not have any code written in it and it does not go away even if I delete my default package and remake it. The only way that I could remove that is by reinstalling the IDE and the JDE. Could you please tell me how to get away from that issue?
@sairos4057
@sairos4057 2 жыл бұрын
I did in a slightly different way but got the same results . . . import java.util.Scanner; public class Main{ public static void main(String[] args) { //|**Creating a program that will find the Hypotenuse of a triangle**|\\ double a; double b; double hypotenuse; Scanner ScannerInput = new Scanner(System.in); //tag 01 System.out.print("Enter the side A: "); a = Double.parseDouble(ScannerInput.next()); System.out.print("Enter the side B: "); b = Double.parseDouble(ScannerInput.next()); hypotenuse = Math.sqrt((a*a)+(b*b)); System.out.print("The hypotenuse is: "+hypotenuse); ScannerInput.close(); } }
@lemonov3031
@lemonov3031 2 жыл бұрын
thank you gigachad
@sadoqatsaidova1993
@sadoqatsaidova1993 Ай бұрын
print("good")😃😃
@majdal-semaan5408
@majdal-semaan5408 Жыл бұрын
2:28 you can't put a negative number under square root😕
@khamedmohammedtaha5423
@khamedmohammedtaha5423 2 жыл бұрын
If the input is an integer what do we do //x=next.double()
@mustafaismail9802
@mustafaismail9802 2 жыл бұрын
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter the value of x : "); double x = scanner.nextDouble(); System.out.print("Enter the value of y : "); double y = scanner.nextDouble(); double z = Math.sqrt(Math.pow(x,2)+Math.pow(y,2)); System.out.print("The Hypotenuse is : " + z); } }
@mojtabamoradi4689
@mojtabamoradi4689 3 жыл бұрын
great!!!!!!
@jadkhalil9263
@jadkhalil9263 2 жыл бұрын
just commenting for the youtube algorithm ;)
@mpathfinder
@mpathfinder 3 жыл бұрын
Math.sqrt didn't work because you can't put a negative number in a root
@mpathfinder
@mpathfinder 3 жыл бұрын
No flaming I'm so impressed of all you made here
@paia6447
@paia6447 2 жыл бұрын
But, sir it ain't work without import java.lang.Math; and thank you for your explanation
@anjolianjoli4229
@anjolianjoli4229 2 жыл бұрын
One prayer for KZbin algorithm
@elefteris
@elefteris 2 жыл бұрын
if i want to know the max numer in an array with input number and dimension, can i use somehow Math.max or i have to use For loop and do a temp variable to save every loop the max number?
@batnana4777
@batnana4777 3 жыл бұрын
When I tried to do "math." it would only show class and main string? any1 know why edit: Is it because the public class is named Math?
@HavocMusic1759
@HavocMusic1759 3 жыл бұрын
probably
@RyanMcCollom
@RyanMcCollom 3 жыл бұрын
Thank you I had the same problem and couldn't figure this out.
@Ribula1
@Ribula1 9 ай бұрын
What do you mean by closijg the scanner? And what did you by by its nkt necessary?
@duxxgd2733
@duxxgd2733 11 ай бұрын
i love you
@afshanbarlaskar9327
@afshanbarlaskar9327 3 жыл бұрын
keep posting
@zapeeosheikh
@zapeeosheikh 3 жыл бұрын
What's is the purpose of scanner . Close();
@linnko51
@linnko51 3 жыл бұрын
I need help what is scanner.close()? I don't get it what does it do ? someone help?
Java random numbers 🎲 【4 minutes】
4:27
Bro Code
Рет қаралды 159 М.
Java if statements 🚧【6 minutes】
6:12
Bro Code
Рет қаралды 148 М.
大家都拉出了什么#小丑 #shorts
00:35
好人小丑
Рет қаралды 89 МЛН
отомстил?
00:56
История одного вокалиста
Рет қаралды 4,4 МЛН
Array vs. ArrayList in Java Tutorial - What's The Difference?
17:36
Coding with John
Рет қаралды 524 М.
Java Math Library #22
18:41
Alex Lee
Рет қаралды 65 М.
you will never ask about pointers again after watching this video
8:03
Low Level Learning
Рет қаралды 2,2 МЛН
How to accept user input in Java ⌨️【8 minutes】
8:02
Bro Code
Рет қаралды 194 М.
Variables in Java ✘【12 minutes】
12:32
Bro Code
Рет қаралды 200 М.
Java encapsulation 💊
8:27
Bro Code
Рет қаралды 111 М.
Learn Java in 14 Minutes (seriously)
14:00
Alex Lee
Рет қаралды 4,7 МЛН
Java methods 📞
11:05
Bro Code
Рет қаралды 132 М.
This is Why Programming Is Hard For you
10:48
The Coding Sloth
Рет қаралды 852 М.
Java dynamic polymorphism ✨
8:52
Bro Code
Рет қаралды 68 М.
大家都拉出了什么#小丑 #shorts
00:35
好人小丑
Рет қаралды 89 МЛН