#9 Arithmetic Operators in Java

  Рет қаралды 164,546

Telusko

Telusko

Жыл бұрын

Check out our courses:
Spring and Microservices Weekend Live Batch : bit.ly/spring-live-weekend
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-spring-cloud
Udemy Courses:
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
Java For Programmers:- bit.ly/javaProgrammers
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusko.com/
In this lecture we are discussing:
1)Assignment operator
a) = is used to assign a value to a variable
b) += is used to assign a value to a variable by adding it to the existing value
c) -= is used to assign a value to a variable by subtracting it from the existing value
-- there are many but in this lecture we discussing only some
e.g of =
int num1=11;
int num2=12;
int result = num1 + num2;
int result1=num1-num2;
int result2=num1*num2;
int result3=num1/num2;
e.g of +=
int num=1;
num +=1; = num = num+1;
num +=5; = num = num+5;
e.g of -=
int num2=2;
num -=1; num =num-1;
num -=5; num =num-5;
2)increment and decrement operator
-- there are two type of increment and decrement operator
a) pre
b) post
-- post increment and decrement operator
int num=1;
num++;
System.out.println(num); // 2
-- this operator is known as post increment operator
num--;
System.out.println(num); //1
-- this operator is know as post decrement operator
-- pre increment and decrement operator
int num=2;
++num;
System.out.println(num);//3
--num;
System.out.println(num);//2
Difference between pre and post operator
e.g for that we take one example
int num=5;
System.out.println(num++); // 5 is print on console
int num1=5;
System.out.println(++num); //6 is printed on screen
in post
first assignment and then increment
e.g int num=5; int copy;
copy=num++; in this case first num=5 assign to copy then increment the num
copy value is 5;
in pre
first increment then assignment
e.g int num=5;
int copy;
copy = ++num;
in this case first increment num value from 5 to 6 then assign to copy.
copy value is 6;
Github repo : github.com/navinreddy20/Javac...
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
www.telusko.com

Пікірлер: 48
@beqari
@beqari Жыл бұрын
dude has 1.25x speed by default
@CRISTAL_MUSIC
@CRISTAL_MUSIC Жыл бұрын
Still i am watching him in 1.5×
@sudipsen3677
@sudipsen3677 Жыл бұрын
Yeah bro
@taniyasiddiqui5891
@taniyasiddiqui5891 Жыл бұрын
😂😂😂😂
@rajualiendog8954
@rajualiendog8954 8 ай бұрын
Yes me to watching at speet 1.5x
@g.prudvimeher7614
@g.prudvimeher7614 8 ай бұрын
Me watching at 1.75x
@Gattugamerfacts912
@Gattugamerfacts912 Жыл бұрын
Really sir you are great I complete 1 to 10 lecture in one day without any doubt thank you so much sir 🥺🙏
@nirongajanayake2515
@nirongajanayake2515 11 ай бұрын
Sir, I am really grateful for your teachings ❤️❤️
@sandunjayasekara131
@sandunjayasekara131 Жыл бұрын
Best series for learning java, Thank you sir
@BLAZIN77KONG
@BLAZIN77KONG 9 ай бұрын
best tutorial ever
@yitingchen8278
@yitingchen8278 Жыл бұрын
note: when trying to assign a value or fetch a value, post-increment will behavior differently from pre-increment.
@challacharan1648
@challacharan1648 Жыл бұрын
very much help ful
@emhoang252
@emhoang252 7 ай бұрын
thank you
@Manisha_1490
@Manisha_1490 9 ай бұрын
Tq sir😊😊
@tharinduhasarangarubasinsi7714
@tharinduhasarangarubasinsi7714 Жыл бұрын
Sir you did really great :)
@kirubasathish3683
@kirubasathish3683 Жыл бұрын
sir so num1 = num1 + 2; and num1 += 2; is the same thing?
@The_Motobikers_World
@The_Motobikers_World Жыл бұрын
Yes, num1 +=2 internally works as num1=num1+2
@user-pz7dy7uj9o
@user-pz7dy7uj9o 6 ай бұрын
Why video name is Assignment Operator in Java? it should be Arithmatic Operators in Java
@durgaraoponnuru17
@durgaraoponnuru17 Жыл бұрын
When we do num1++ or some other operations, values are being changed in output. Again when we perform another operation, its being performed on default number, instead of updated value. Can anyone explain this. For eg: num1=7; when num1++ is performed, value changed to 8, Again when another operation say num1 +=1; is performed value still showing 8 instead of 9.
@MrPradeepchandu
@MrPradeepchandu Жыл бұрын
Because you are giving num1=7 at start of code everytime you run
@SanjanaGupta279
@SanjanaGupta279 8 ай бұрын
See There is two option first is to use looping statement(For loop, while loop) For Example: class HelloWorld { public static void main (String[] args) { int num1=1; while(num1
@vkyfox
@vkyfox Жыл бұрын
yovvvvv this is arithmetic operator yarrrrr
@yashjangid4222
@yashjangid4222 Ай бұрын
sir please dont say star say Asterisk so the students can get a new work thank you sir
@mango-strawberry
@mango-strawberry Жыл бұрын
9:56
@nishalsreekanta7802
@nishalsreekanta7802 7 ай бұрын
4:18 the output must have been 7 right? Because num1 is assigned with 9 after increment? 9 - 2 = 7. But how was the output 5 and even in multiplication it took 7 * 8 and not 5 * 8. Can someone explain this ?
@barathkraja5681
@barathkraja5681 6 ай бұрын
It was commented out with double slash after it was made to 9. So now num 1 will be with its original value and will remain as 7. Now when num1 -= 2 is coded, it will result in output as 5. The same goes with multiplication since now original value of num1 remains 7 and when the line num1 *=8 it's num 1= num1(which is 7) *8 = 56
@alfredndlovu356
@alfredndlovu356 3 ай бұрын
Was the title of this video not meant to be "Arithmetic Operators in Java" ?
@sm07
@sm07 Жыл бұрын
What is the difference Between public static void main(String a[])
@quickkcare605
@quickkcare605 Жыл бұрын
Just a name difference, just like you can give variable any name
@whytimes863
@whytimes863 Жыл бұрын
No difference, bro. You can put any name there a[], args[], sampath[], anything.
@sm07
@sm07 Жыл бұрын
Thanks guys
@abhijaiallgamesgamer2075
@abhijaiallgamesgamer2075 Жыл бұрын
i just realized u were using macOS
@vivekvardhan6491
@vivekvardhan6491 Жыл бұрын
when you increment the value it should print 8 but why it is printing 7.
@hari3245
@hari3245 Жыл бұрын
Bcz we insert is this to system. Out. Println() ; // we insert than number it is perform value & condition & Inc/dec Ex: For(int vivek =1;vivek
@vivekvardhan6491
@vivekvardhan6491 Жыл бұрын
@@hari3245 So 1st the given value is going to print and then it will perform other condition right.
@hari3245
@hari3245 Жыл бұрын
@@vivekvardhan6491 yeah..
@Naveen_kumar14
@Naveen_kumar14 10 ай бұрын
Why he used double // slash can anyone explain me
@shazam8095
@shazam8095 Ай бұрын
it is used to make that line a comment which will be ignored by java while running
@Ilamaran-n9f
@Ilamaran-n9f 7 күн бұрын
// for what purpose he was using this !!!
@Ilamaran-n9f
@Ilamaran-n9f 7 күн бұрын
in the literal series also he didn't explain about it😔
@nandakishore8447
@nandakishore8447 9 ай бұрын
public class confus { public static void main (String args[]) { int num = 7; int a = ++num; int b = num++; System.out.println(a); System.out.println(b); } } this program getting output as 8 8 instead 8 7 any explanation please
@ckubri5061
@ckubri5061 9 ай бұрын
bro im not sure wt u r asking but, the post n pre increment does the same job but differently...like said in the video. ++num n num++ will give the same output for 7. As we know if we give our intial value e.g num=9, we get 10 either if we give ++num or num++ but ur class name😹
@barathkraja5681
@barathkraja5681 6 ай бұрын
So the reason why b is giving result as 8 is when a= ++num is executed value of num changes to 8 and so b fetches the last updated value of num which is 8 and prints it and then increments it to 9. Now when a=++num is executed a will be printed as 10 and b as 10 and then a as 11 and b as 11 and so on. Basically value of num changes even though you assign that to a separate variable like a or b.
@amitavaghosh7201
@amitavaghosh7201 Жыл бұрын
Too much videos uploaded at the same time
#10 Relational Operators in Java
8:05
Telusko
Рет қаралды 129 М.
#8 Type Conversion in Java
12:33
Telusko
Рет қаралды 247 М.
لااا! هذه البرتقالة مزعجة جدًا #قصير
00:15
One More Arabic
Рет қаралды 14 МЛН
Пранк пошел не по плану…🥲
00:59
Саша Квашеная
Рет қаралды 7 МЛН
IQ Level: 10000
00:10
Younes Zarou
Рет қаралды 11 МЛН
Fastest Way to Learn ANY Programming Language: 80-20 rule
8:24
Sahil & Sarra
Рет қаралды 807 М.
#23 JDK JRE JVM in Java
5:22
Telusko
Рет қаралды 223 М.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
pixegami
Рет қаралды 256 М.
Relational vs. Non-Relational Databases
8:12
IBM Technology
Рет қаралды 103 М.
What's new in Java Switch | Switch Statement and Expression
11:09
Look, this is the 97th generation of the phone?
0:13
Edcers
Рет қаралды 8 МЛН
Better Than Smart Phones☠️🤯 | #trollface
0:11
Not Sanu Moments
Рет қаралды 18 МЛН
Vision Pro наконец-то доработали! Но не Apple!
0:40
ÉЖИ АКСЁНОВ
Рет қаралды 453 М.
Rate This Smartphone Cooler Set-up ⭐
0:10
Shakeuptech
Рет қаралды 6 МЛН