Can anyone please explain the Value types?? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 4

Can anyone please explain the Value types??

28th Nov 2018, 11:47 AM
@nkusha
@nkusha - avatar
7 Réponses
+ 5
Thanks Ankusha Khotele, and you're welcome : )
29th Nov 2018, 5:08 AM
Ipang
+ 6
Hello, 😊 Can you specifying your question correctly! Use the search bar! https://www.sololearn.com/post/10362/?ref=app Please, read our guidelines: https://www.sololearn.com/discuss/1316935/?ref=app An useful code for any new user here!;) https://code.sololearn.com/WvG0MJq2dQ6y/
28th Nov 2018, 3:15 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 5
Please add "java" to the "Relevant Tags" of the original post, it helps others to understand you sooner by indicating the language. To answer the doubt, the addOneTo method in the lesson was designed to show you that value types are immutable, that means when the <num> is incremented in the method the changed value of <num> is only recognized in the addOneTo method itself, not where they were declared initially (main method for example). The original variable value is not changed, I hope my explanation was clear enough.
28th Nov 2018, 2:30 PM
Ipang
+ 3
I think you are asking about data types in programming languages? If my guess is right than here's the answer There are different types of data such as numbers , strings etc. To declare variables we must specify the data type , variable is holding. If its integer we write int a = 10; (C language) Hope its helps☺️☺️.
28th Nov 2018, 12:46 PM
Meet Mehta
Meet Mehta - avatar
+ 3
Thank you Meet and Rahul. My doubt is why in Value Type example, mentioned in Value Type topic i.e. me to Static void addOneTo(int num) { num = num+1; } doesnot make any change to variable value
28th Nov 2018, 1:10 PM
@nkusha
@nkusha - avatar
+ 3
Thank You Ipang. I'll add the tags further Danijel.
29th Nov 2018, 5:06 AM
@nkusha
@nkusha - avatar
+ 1
value type means a value is given and is't type is "char" than we want to put values line some ones name or some alfabate and when vlaue type is 'integer ' than we want to use number 1,2,3,3423, and in condition of "flot value " we use decimals 6.7,0.6
28th Nov 2018, 12:35 PM
Rahul Erpache
Rahul Erpache - avatar