Programme ඒකක් run වෙන්න නම් අපි විවිදාකාර දත්ත(Data) එයට ලබා දිය යුතුයි. ඉතින් ඒ ලබා දෙන දත්ත සදහා විවිද වර්ග තිබෙනවා.
- Numbers – Integer (48) and floating points (57.56)
- Textual – characters (‘A’) and strings (“Hello”)
- Boolean – true or false
Numeric Data (සංඛ්යා)
Integers – Whole numbers (පූර්ණ සංඛ්යා)
e.g. 25, 37, 296, 5776
Integers are of four types
byte – 8 bit
short – 16 bit
int – 32 bit
long – 64 bit
Floating point numbers – decimal numbers (දශමය සංඛ්යා)
e.g. 25.65, 36.75
Float – single precision – less accurate e.g. 25.5
Double – double precision – more accurate e.g. 3.142356
Texts
char – to store single character (ඒක් අකුරක් සදහා)
e.g. ‘a’, ‘A’
String -to store any combination characters values(අකුරුු කිහිපයක්)
e.g. “Hello-123”
විශේෂිත යෙදුම්
\n – new line character
\t – tab character
\” – double quotes
\’ – single quotes
\\ – backslash
To store true / false – boolean
+ : addition
– : subtraction
* : multiplication
/ : division
% : modulus division (reminder)
Constants (නියත අගයන්)
වෙනස් නොවන අගයන් ගබඩා කිරීම සදහා අප පහත පරිදි යොදාගනු ලබනවා
public static final double PI = 3.142857;