Wednesday, November 16, 2016

Core Java Notes[session4]

Language fundamentals
---------------------
1)variables
2)keywords
3)constants
4)datatypes
5)operators


variable
--------
*Variable is an identifier which identifies a value,whose value changes.

syntax
------
datatype variablename;

ex:
 int a;


Rules for declaring variables
-----------------------------
*A variable should start with alphabet or underscore or dollar.

*No special symbols are allowed in a varible except underscore(_) and dollar($)

*No blank spaces are allowed in a variable.


ex:
v-valid
iv-invalid
a(v)
b(v)
abc123(v)
123abc(IV)
a_bc_c(v)
a+b+c(iv)
a bc(v)
s_(v)
_$(v)
$123(v)
%@abc(iv)
$(v)
_(v)


Keywords
--------
*keywords are builtin or predefined words.

*There are around 53 keywords in  java

ex:
int
char
float
double
long
while
do
for
class
etc

Rules for declaring keywords
----------------------------
i)A keyword must be declared in lowercase.

ii)we cannot use keywords as identifiers.


ex:
c-correct
ic-incorrect

INT(ic)
Float(ic)
while(c)

int int;(iv)

int x;(c)


No comments: