#6 Data types in Java
Vložit
- čas přidán 15. 01. 2023
- Check out our courses:
Enterprise Java Spring Microservices: go.telusko.com/enterpriseJava
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : go.telusko.com/masterjava
Coupon: TELUSKO20 (20% Discount)
For More Queries WhatsApp or Call on : +919008963671
Udemy Courses:
Spring: go.telusko.com/udemyteluskosp...
Java:- go.telusko.com/udemyteluskojava
Java Spring:- go.telusko.com/Udemyjavaspring
Java For Programmers:- go.telusko.com/javaProgrammers
Python : go.telusko.com/udemyteluskopy...
Git : go.telusko.com/udemyteluskogit
Docker : go.telusko.com/udemyteluskodo...
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusko.com/
In this lecture we are discussing
1) datatypes for given variable
a)Types of data-types?
b)primitive data types
c)why do we need different type of integer type?
d)how to create variable of different data types?
2) range and way to declare different data variable
#1
a) Datatypes are categories into primitive and non-primitive datatype.
But in this lecture, we are take all concept upon primitive data type.
b) There are 8 primitive datatype
integer ---byte, short, int, long
float --- float , double
character ---char
boolean --- boolean
c) why do we need different type of integer ?
= there are range for each type. for int --4 bytes ,long --8 bytes, short --2bytes byte --1byte
d) How to create variable of different data type?
= int a=10; byte b=4
= dataType variableName = value;
integer variable declaration
int a=5;
long b=600l; // e.g 578l, 100000l represent long integer type
byte c=127;
short s=128;
float vs double
=double have more precision than float by default java support double.
=declare variable of float and double type
--double a=5.6;
--but float b=5.6; //give error
--correct way float b=5.6f;
character representation
= char ch='a'; //using single quotes on character we can declare char type of variable
boolean representation of variable
= boolean result=true; there are only two value of boolean either true or false.
=In other language like c and c++ -- 0 is treated as false and non zero number treated as true but it is not in java.
{byte, short, int, long, float, double, char, Boolean }
since java is statically type or say strongly type language therefore we need
to mention datatype for each variable for declaring variable.
e.g int i=5; float f=2.5f;
In java integer are by default for integer int type;
for real number by default double
#2
Range and way to declare different data type variable
int i=5;// 4 bytes ---32 bytes -- -2147483648 to 2147483647
short s=5;//2 bytes -- 16 bytes -- -32768 to 32767
byte b=5;//1 byte -- 8 bytes -- -128 to 127
long l=5;//8 bytes -- 64 bytes -- -9223372036854775808 to 9223372036854775807
float f=5.5f;//4 bytes -- 32 bytes -- 1.4e-45 to 3.4028235e+38
double d=5.5;//8 bytes -- 64 bytes -- 4.9e-324 to 1.7976931348623157e+308
char c='a';//2 bytes -- 16 bytes -- 0 to 65535
boolean check=true; //value is either true or false
ASCII - American Standard Code for Information Interchange
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 - Věda a technologie
sir where were u......got a diamond in search of gold♥
Whoa! so much information in such a small video. Here are the points which I liked the most:
1. Real values are treated as double by default. We have to explicitly specify float value.
(Ex.: double d = 5.6 --> no error ; float f = 5.6 --> error)
2. Only 'true' and 'false' are treated as boolean.
(Ex.: if(true) --> no error ; if(1) --> error)
Thanks Navin for the info :)
Why does the mac allow the float f = 5.6 and windows only accepts float = 5.6? I can not find this on Google and this course is hard to follow when I am playing follow the leader to a T.
Thank you sir very nice gide & very nice best java in data type teaching information video..👍
Thanks a lot! I will watch whole series to refresh my java skills :D
thank you so much sir...superb explanation..
Thanks ,great explanation in detail and in a simple way to understand
Thank you Sir...............Excellent Explanation
really helpful, thanks !
Thank You Sir ❤
quality content 🙌
GOOD EXPLATIONS
Thank you
It's vry helpful👍💯
Keypoints:
1. default: double (8bytes) not float
2. char datatype: only one character and single quotes are allowed
3. write f at the end of float, l at the end of long
4. byte range: [-128 , 127]
when ur printing input output is not print syout how u get output
May you please make a video series on making a 3d Game Engine with Java
Please update when you do
Thank you sir Please Try To upload Servlet, JSP And Spring Videos Also In 2023
Hi do you have C# tutorial?
why can you put only one character/letter/number in the char variable?
Sir i have one question if u all the content of topic is covered in such a small times
Sir ek baar main hi sare video daal diye aapne 😅
Im getting error constantly says
Could not find pr load main class Hello
Class not found what should i do??
Sick series to watch in 2023^
What do u mean?
@@AnuragRawat01aq
Lq
I am first viewer on this video
i am searching for advanced java can u help me??
Awesome
I wrote this code and cant get what is wrong with it
class Hello
{
public static void main(String a[])
{
Char c = ‘k’;
System.out.print(c);
}
}
when i compile it , it shows these errors
Hello.java:5: error: illegal character: '\u00b4'
Char c = ┬┤k┬┤;
^
Hello.java:5: error: illegal character: '\u00b4'
Char c = ┬┤k┬┤;
^
Hello.java:5: error: not a statement
Char c = ┬┤k┬┤;
^
3 errors
How to resolve?
C of char should be small, not capital
it is System.out.println, not print
@@bethesuper4500 println just means print on new line, so that isn't major issue. but it is easier with println.
Same I'm getting continuous errors don't know why 😢😢😢
12/5/24
what you are typing to compile in terminal . i'm not getting you there
First he types "javac" to compile the problem and if the program is compiled successfully without any errors then he types the program name. For example "Hello".
Here is a total code
class Hello{
public static void main(String args[]){
char c = 'k';
System.out.print(c);
}
}
After you write this
Do this in your Terminal
javac Hello.java
java Hello
Then your output will come.
where is reference data types
class Hello
{
public static void main(String a[])
{
System.out.println(3 + 5);
}
}
for this code i get this "Hello world"
You have to run the code first then you will get the result