Java Tutorial # 4 | Data Types and Type conversions in Java | JAVA9S.com

///Java Tutorial # 4 | Data Types and Type conversions in Java | JAVA9S.com

Java Tutorial # 4 | Data Types and Type conversions in Java | JAVA9S.com

FavoriteLoadingAdd to favorites

Download the PPT and example code at
This tutorial explains about the java primitive data types like byte, short, int, long, float, double, char, boolean. In this video tutorial i have explained the memory allocated to each data type and the range of numbers it can hold. This tutorial also explains how the two complement will be used to represent the negative numbers in java.

source

Java468x60
By |2019-07-09T21:01:06+00:00July 9th, 2019|Java Video Tutorials|39 Comments

39 Comments

  1. Anna Bear July 9, 2019 at 9:01 pm - Reply

    you're wrong, for double you don't need to add a d at the end but for long you need to add a l at the end.

  2. Hemanth Kumar July 9, 2019 at 9:01 pm - Reply

    why at the end of floating data type variable declaring f

  3. DHANIMIREDDY PADMAVATHI July 9, 2019 at 9:01 pm - Reply

    good explanation, Thank you.

  4. reshma kakarla July 9, 2019 at 9:01 pm - Reply

    Super sir thanq so much keep going thanq

  5. Simran Knight July 9, 2019 at 9:01 pm - Reply

    watched thin 1.5x speed… it's good…

  6. Bharat Kumar Gupta July 9, 2019 at 9:01 pm - Reply

    Fantastic. Complete explaination

  7. sandeep usa July 9, 2019 at 9:01 pm - Reply

    plsss naku applet concept in Java explain cheyara

  8. AYBIN. V. K July 9, 2019 at 9:01 pm - Reply

    Thanks

  9. Dinesh Guptha July 9, 2019 at 9:01 pm - Reply

    Hi ,

    When I tried to execute the below value for int and long data types it is throwing an error as "The literal12345678900 of type int is out of range" for both data types.It is not allowing me to give more than ten digits.

    int integer=12345678900;
    long ln=12345678900;

    Please let me know why am getting this error.

  10. Dinesh Guptha July 9, 2019 at 9:01 pm - Reply

    Hi ,

    When I tried the below steps, I got negative value….could you please explain this concept

    byte by=(byte) 151;
    System.out.println("the new byte value is"+by);

    The result is : -105

  11. harshavardhanreddy kota July 9, 2019 at 9:01 pm - Reply

    wow….impressed

  12. subham singh July 9, 2019 at 9:01 pm - Reply

    sir can u tell me how to take both integer as well as string data type in an array in java….

  13. bhagyashree chauhan July 9, 2019 at 9:01 pm - Reply

    Sir, It is very useful. However, I am stuck in the example of explicit conversion. i.e., when we used explicit conversion for short to byte then also the value changes from 300 to 44. How?

  14. JITESH BABLANI July 9, 2019 at 9:01 pm - Reply

    sir how can you convert integer into char without any explicit conversion or casting

  15. Abdalla Sufi July 9, 2019 at 9:01 pm - Reply

    thnks bro keep it up

  16. jason mendezlara July 9, 2019 at 9:01 pm - Reply

    ¡ thanks man, nice explication !

  17. TSU RATZ July 9, 2019 at 9:01 pm - Reply

    you cant use long for everything because it will use more memory/ram of the user who is running your program .

  18. venu9955 July 9, 2019 at 9:01 pm - Reply

    Great job, thank you.

  19. Garima Arora July 9, 2019 at 9:01 pm - Reply

    hi sir i want more example on encapsulation and abstraction

  20. Neal Ryan Cruickshank July 9, 2019 at 9:01 pm - Reply

    88eb well for platforms with a larger amount of memory it isnt a problem but remember when u declare a variable of a type you are giving that variable a place in the ram, random access memory. if u use a byte, it will allocate space in the memory to store a byte, if u declare an int it will allocate a space in the memory for an int, the size allocated is dependant on the TYPE of the variable, if u have limited resources uses smaller primitives for smaller numbers int is the standard though

  21. Sunil Burli July 9, 2019 at 9:01 pm - Reply

    sir u mentioned big integer is avilable in java can u jst explain with an example

  22. abhishek mishra July 9, 2019 at 9:01 pm - Reply

    bcoz if u going to use long data type evrytime…it is going to occupy mire memory for the object in random access memory which is certainly not good for your program memory management

  23. Srinvas R Rao July 9, 2019 at 9:01 pm - Reply

    Dear Srinivas Reddy:
    Please include keyboard input which is most essential from programmer's point of view
    SUCH AS;
    Data InputStream d1 ……..Instance of DataInputStream class
    String s1=d1.readLine();—–Default String values
    [variable] int a=Integer.parseInt(d1.readLine()); —–converting to Integer(parse from String to Integer)
    I hope u include this concept in video and give a lot of prominence to this in Data Types as we have to accept data from keyboard.REST SUPERB!
    Thanks
    SrinivasRao

  24. srinivas reddy July 9, 2019 at 9:01 pm - Reply

    When you assign long for the variables, you occupy more memory that that is needed for storing the variable… if you are working on large data mining projects, these things might matter…

  25. HariDasa July 9, 2019 at 9:01 pm - Reply

    Why don't you take some time and learn Java, then the need to outsource will not arise!!

    Sadly, you won't and will blame countries like India and China.

  26. 88eb July 9, 2019 at 9:01 pm - Reply

    Question: why is it important to set the right range? why can't I just use "long" for everything?

  27. icarrydateam July 9, 2019 at 9:01 pm - Reply

    good video…unfortunately outsourcing of IT related jobs are becoming more prevalent due to the better education these countries are getting…..

    there is no future for engineers in America unless we impose some type of embargo or tariff

  28. MOMIN MAHABOOB July 9, 2019 at 9:01 pm - Reply

    plz shjare some more videos sir jiiiiiiiiiiiii

  29. David Gomez July 9, 2019 at 9:01 pm - Reply

    this guy just made my java class a whole lot easier, keep up the good work

  30. georgebin joy July 9, 2019 at 9:01 pm - Reply

    Nice video presentation.

    dataentryservicesonline. com

  31. Rajesh RK July 9, 2019 at 9:01 pm - Reply

    Nice video sir ……….but iam having one doubt sir……already we seperated businesslogic and presentation logic in jsp then what is the specality of jee.sir please reply to my answer thank you………….

  32. Geeta Tiku Goswami July 9, 2019 at 9:01 pm - Reply

    VERY USEFUL… THANK A LOT!!!!

  33. Ahmed Raza July 9, 2019 at 9:01 pm - Reply

    cool

  34. Prabhanjan Pedgaonkar July 9, 2019 at 9:01 pm - Reply

    awsmme!!

  35. Arnav Bhan July 9, 2019 at 9:01 pm - Reply

    cool tutorial cheers make one on hacking

  36. killerbeenl July 9, 2019 at 9:01 pm - Reply

    Great tutorials by the way. Love it.

  37. killerbeenl July 9, 2019 at 9:01 pm - Reply

    Byte – binary presentation feels unnaturally coming from electronics to this. Like 10000001 sounds like 128 decimal to me. So its first bit declaring negative and then the other 7 bits declare decimal number. So 10000001 is actually -127 am i right? I've done some programming on microchip microcontrollers this still feels strange.

  38. babu July 9, 2019 at 9:01 pm - Reply

    excellent explanation thanks

  39. SynforgeGames July 9, 2019 at 9:01 pm - Reply

    nice vid
    my book didnt explain the correlation between 8 bit and -127 128 so Im glad to fully understand now. Do you know the range for double & float and the correlation?

Leave A Comment

*