+ 4

Why in java the s in String is capital but for other variables it is small.

26th May 2018, 11:13 AM
Samarth Madan
Samarth Madan - avatar
24 Respostas
+ 13
Classes are capitalized, primitives lower cased. String is a class, so it starts with a capital.
26th May 2018, 11:17 AM
Tashi N
Tashi N - avatar
+ 9
The primitive datatypes like int, double, float... Explanation and full list: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
26th May 2018, 11:22 AM
Tashi N
Tashi N - avatar
+ 6
To learn more look for sections on "Data Structures" in various courses.
26th May 2018, 2:50 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 5
It is a symbol for an array, a list of elements. Individual elements are called indices. So you could have an array of Strings ["my", "name", "is", "Joe"] and you could manipulate it by calling elements by index. The first element is called the zero index.
26th May 2018, 2:01 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 5
Think of an array as a container with a number of small compartments.
26th May 2018, 2:21 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 5
each compartment holds a number, or a string.
26th May 2018, 2:37 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 5
or even a character.
26th May 2018, 2:42 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 5
By declaring an array you arrange your data into compartments your program can access, analyze, or modify.
26th May 2018, 2:44 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 4
what are primitives ?
26th May 2018, 11:18 AM
Samarth Madan
Samarth Madan - avatar
+ 4
Primitive types are the most basic data types available within the Java language. There are 8: boolean , byte , char , short , int , long , float and double . These types serve as the building blocks of data manipulation in Java. Such types serve only one purpose — containing pure, simple values of a kind.
26th May 2018, 11:22 AM
MsJ
MsJ - avatar
+ 4
But first play with small arrays, 4 or 5 elements.
26th May 2018, 2:18 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 4
There are many times than one learns new things here before in lessons.
26th May 2018, 10:23 PM
David Rueda 🇪🇸
David Rueda  🇪🇸 - avatar
+ 3
Ok I'll try a little more. Arrays and similar structures like ArrayLists and dictionaries are a central, critical part of programming. They let you work on sets of data including very large sets like tracking cars for a Department of Motor Vehicles or tracking health data or something like air quality in lots of different places.
26th May 2018, 2:18 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 1
primitives are not capitalized: int, short, boolean, long, char, float, double, byte. But classes, such as String, Integer and Boolean, are capitalized, by convention.
26th May 2018, 11:22 AM
ifl
ifl - avatar
+ 1
what is the meaning of this symbol [ ]
26th May 2018, 1:49 PM
Mouhammad Tarek Rayed
+ 1
i learn now this things thanks very much
26th May 2018, 2:45 PM
Mouhammad Tarek Rayed
+ 1
okk
26th May 2018, 2:55 PM
Mouhammad Tarek Rayed
+ 1
because String is class
26th May 2018, 4:36 PM
Shailesh Kodulkar
Shailesh Kodulkar - avatar
+ 1
because in Java everything is considered as an object or primitive type. String in java is a class not a primitive type so it starts with capital 's'. for primitive types we use small alphabets as first alphabet of it's name.
26th May 2018, 11:08 PM
Hossein Dehghanipour
Hossein Dehghanipour - avatar
0
"String" is inbuilt class in java and all inbuilt class names in java start with capital letter
26th May 2018, 12:47 PM
Samar Shaikh
Samar Shaikh - avatar