java fundamentals


Identifiers in java:

A name in java programming is called identifier.

It can be class or method name or variable name


Example:

class Demo{

int sum;
public static void main(String[] args){
System.out.println("we are entering java world");
}

In above all red color words are identifiers.

Rules for defining variable:




1)Allowed characters in java identifiers are
     1.a to z
     2.AtoZ
     3.0to9
    4.'_'
    5.$
if we are use any other character we will get compile time error.


2)Identifiers should not start with digit

   ex:int 1a;(wrong)
  ex2:int a1(correct)


3)java language is case sensitive
  so int a,A; both are different identifiers


4)There is no length limit for java identifiers but it's not recommended to take more than 15 characters


5)we cant's use reserved word's as identifiers
  ex: int if ;(wrong compile time error)
  















Author

Written by Admin

Aliquam molestie ligula vitae nunc lobortis dictum varius tellus porttitor. Suspendisse vehicula diam a ligula malesuada a pellentesque turpis facilisis. Vestibulum a urna elit. Nulla bibendum dolor suscipit tortor euismod eu laoreet odio facilisis.

0 comments: