Lesson 2 of 34
Variables மற்றும் Data TypesVariables and Data Types
8 min 20 XP
Java-ல் ஒரு variable உருவாக்கும்போது அதன் type-ஐ முதலில் சொல்ல வேண்டும். int முழு எண்களுக்கு, double தசம எண்களுக்கு, boolean true/false-க்கு, char ஒரு எழுத்துக்கு, String text-க்கு.
In Java you must state a variable's type when you create it. int is for whole numbers, double for decimals, boolean for true/false, char for a single character and String for text.
Example: edit me and press Run
Press Run to see the result here.String-உடன் + சேர்த்தால் அவை ஒன்றாக இணையும் (concatenation). Variable-ன் மதிப்பை பின்னர் மாற்றலாம், ஆனால் type மாறாது. char-க்கு single quotes ' ', String-க்கு double quotes " ".
Using + with a String joins values together (concatenation). You can change a variable's value later, but not its type. A char uses single quotes ' ', a String uses double quotes " ".
Example: edit me and press Run
Press Run to see the result here.final என்று போட்டால் அந்த variable-ஐ மீண்டும் மாற்ற முடியாது (constant). Constant பெயர்களை CAPITAL எழுத்துகளில் எழுதுவது வழக்கம்.
Mark a variable final and it can never change (a constant). Constant names are usually written in CAPITALS.