Variables, data types , Constant(PHP, JavaScript, Java) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Variables, data types , Constant(PHP, JavaScript, Java)

I cant understand those parts. Its hard for me to set them in my mind. If someone can give me some example of them and some uses of them by some project or code( I need to know how they have been used in any project) it would be much appreciated. Thanks in advance

15th May 2017, 3:12 PM
DarkPrince
DarkPrince - avatar
3 Answers
+ 5
Java: DataTypes/ Primitive. Non-Primitive. int. Arrays boolean. Strings float. Self. defined Objects double. etc... long short bye char q) Is there a way to tell if a data type is non-primitive? Yea, look at the capitol letters 😜. (is the first letter in caps?) Constants are variables that cannot change in value once defined. Denoted with the keyword 'final'. Ex/ final float PI = 3.14; This is a constant. Now it is impossible to change its value. Ex/ final float PI = 3.14; PI = 3.1415; // ERROR decimals: double > float Whole numbers: long > int > short > byte True or false: boolean Character: char Denoted ' ' Ex/ char a = 'a'; Bunch of characters: String Denoted " " Ex/ String word = "hello";
15th May 2017, 3:46 PM
Rrestoring faith
Rrestoring faith - avatar
+ 2
Tnx for your effort, its very helpful, i really appreciate it but if someone post any code based on these it would be more helpful and bro you missed javascript and php with codes
16th May 2017, 3:56 PM
DarkPrince
DarkPrince - avatar
+ 2
And i want to know if string is anything inside quotes..
16th May 2017, 3:58 PM
DarkPrince
DarkPrince - avatar