It is a set of symbols which are used to write a Java Program.
Examples:
A to Z
a to z
0 to 9
Special Symbols ( ) [ ] { } + - & % ….
The above are all the symbols available on your keyboard. If you are developing any application in 'C' language then it can support only English language because 'C' is based on 8-bit ASCII character set. However, Java is based on 16-bit UNICODE character set. Hence Java based applications can support many languages.
When, you are developing an application in Java, you can use Internationalization (I18N) or Localization development processes. Java applications that use encoding standards till UNICODE Standard Version 4.0 support almost all languages except Sanskrit and few other languages. However, Java applications that use encoding standards from UNICODE Standard Version 5.0 and above can also support Sanskrit language symbols, Rupee symbol and few more new symbols.
Link for UNICODE:
https://www.ssec.wisc.edu/~tomw/java/unicode.htmlEvery implementation of the Java platform is required to support the following standard charsets. Refer the release documentation for your implementation to see if any other charsets are supported. The behavior of such optional charsets may differ between implementations.
Charset | Description |
---|---|
US-ASCIII | Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set. |
ISO-8859-1 | ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1 |
UTF-8 | Eight-bit UCS Transformation Format |
UTF-16BE | Sixteen-bit UCS Transformation Format, big-endian byte order |
UTF-16 | Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark |
Charsets are named by strings composed of the following characters:
The uppercase letters 'A' through 'Z' ('\u0041' through '\u005a')
The lowercase letters 'a' through 'z' ('\u0061' through '\u007a')
The digits '0' through '9' ('\u0030' through '\u0039')
The dash character '-' ('\u002d', HYPHEN-MINUS)
The plus character '+' ('\u002b', PLUS SIGN)
The period character '.' ('\u002e', FULL STOP)
The colon character ':' ('\u003a', COLON)
The underscore character '_' ('\u005f', LOW LINE)
Keyword is a pre-defined word which implies that the word contains a pre-defined meaning.
o All the Java Keywords are in lower case.
o We can't change their format.
Examples:
class A{
public static void main(String arg[]){
System.out.println("This is Class-A");
}
}
This is Class-A
Here, defining a class A and some keyword like this…
Keyword: class | public | static | void
In programming languages, identifiers are used for identification purposes. In Java, an identifier can be a class name, method name, variable name, or label.
Some words in Java are reserved and cannot be used as identifiers.
Example:
A person’s name.
An employee’s employee number.
An individual's social security number.
public class JTC_India{
public static void main(String[] args) {
int a = 99;
double d = 2.0;
System.out.println("Hello World!");
}
}
Hello World!
In the above program we have used some identifiers and these are: -
• JTC_India (Class name)
• main (Method name)
• String (Predefined Class name)
• args (String variable name)
• a (integer variable name)
• d (double variable name)
• System (Predefined Class name)
• out (Variable name)
• println (Method name)
• Keywords cannot be used as identifiers
• Identifiers must not start with any numeric or it is always recommended to start some of the identifiers with small case.
• It must not contain any special symbol other that (_) or $.
• Identifiers must not contain any blank space in between.
• Identifiers may contain numeric though not as a first letter.
Example1:
Int ab; // ok
Int a_b; // ok
Int a b; // not ok
Example2:
class JTC {
public static void main(String[] args) {
Identifier h1=new Identifier();
h1.m1();
}
}
class Identifier {
int a;
int ab;
int ab1;
int a1b;
int a_b;
int ab_;
int _ab;
int a$b;
int _$;
int Integer;
int INT;
int For;
void m1(){
System.out.println("m1 in Hello");
System.out.println(Integer);
System.out.println(INT);
}
}
m1 in Hello 0 0