TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Saturday, 28 December 2019

tokens in hindi java tokens identifiers | java in tokens tutorials

Java Token

A java program is made up of class and method and in the method are the container of the various statement and a statement is made up of variable,  constants operators, etc.
Tokens are the various java program elements which are identified by the compiler are separated by delimiters. The delimiters are not part to the tokens. A tokens is the smallest element of a program that is meaningful to the compiler. The compiler breaks lines line into chunks of text called keywords, variable, constant, special character, operations, etc.


java tokens ppt, tokens in java
tokens in java

When you compile a program, the compiler scans the text in your source code and extracts individual tokens. While tokenizing the source file, the complier recognize and subsequently  remove whitespace (space, tabs newline and form feeds) and the text enclosed within comments. Now lets as consider a program.
//Print Hello
Public class Hello
{
public static void main(String agrs[])
{
System.out.println(“Hello Java”);
}
}
Tokens are the smallest unit of program. There is Five types of Tokens
   1.   Keyword
   2.   Identifier
   3.   Separators
   4.   Operators
   5.   Literals


o  Keyword- Java keywords are also known as reserved words. Keywords are particular words which acts as a key to a code. These are predefined words by Java so it cannot be used as a variable or object name.

                  List of Java Keywords

        A list of Java keywords or reserved words are given below:
1.    abstract: Java abstract keyword is used to declare abstract class.          Abstract class can provide the implementation of interface. It can have abstract and non-abstract methods.
2.    boolean: Java boolean keyword is used to declare a variable as a             boolean type. It can hold True and False values only.
3.    break: Java break keyword is used to break loop or switch statement. It breaks the current flow of the program at specified condition.
4.    byte: Java byte keyword is used to declare a variable that can hold an 8-bit data values.
5.    case: Java case keyword is used to with the switch statements to mark blocks of text.


java tokens in hindi java in tokens tutorials
java keyword

                         Keywords in Java

  o  Identifier- Java Identifiers are used to identify a class name, method    or variable name and also a label. Let’s discuss with an example-

1.    public class Student
2.    {
3.    public static void main(String[] args)
4.    {
5.    int number = 5;
6.    }
7.    }

    Above Java Identifier example, we have 5 identifiers, they are –

1.    Student is the name of the class.
2.    main is the main method.
3.    String is a predefined class name.
4.    args are the string variables.
5.    number is the name of the variable.

                   Rules for Identifiers in Java

There are certain rules for declaring an identifier. We need to follow these rules otherwise we will get a compile-time error.

1.    A valid identifier has characters [A-Z],[a-z] or numbers [0-9], $ (dollar sign) and _ (underscore). For example, @dataflair is not a valid identifier, because it contains @ which is a special character.

2.    We can’t declare a variable with space. For example, data flair is invalid.

3.    We can’t start an identifier with a number. For example, 222dataflair is not a valid identifier.

4.    As there is no limit on the length of an identifier but it is 4 – 15 letters only appropriate to use.
5.    It is not recommended to use Reserved words as an identifier. For example, int float=5; is not a valid statement.


java tokens in hindi | java tokens ppt tokens in java
java token identifire

                                   Example of Identifier

Separators- A separator is a symbol that is used to separate a group of code from one another is called as separators in java. In java, there are few characters that are used as a separator. The most commonly used separator is a semicolon. As we have seen it is used to terminate the statement.


java tokens in hindi | java tokens ppt tokens in java
java in tokens

Separators Example


 o  Operators- An operator is a special symbol that tells the compiler to perform a specific mathematical or logical operation on one or more operands where an operand can be an expression.

Operators are special symbols (characters) that carry out operations on operands (variables and values). For example, + is an operator that performs addition.

Java operators can be classified into a number of related categories as below:

1.    Arithmetic operators
2.    Relational operators
3.    Logical operators
4.    Assignment operators
5.    Increment and decrement operators
6.    Conditional operators
7.    Bitwise operators
8.    Special operators

java tokens in hindi | java tokens ppt,
token identifier

 o  Literals- Java Literals are syntactic representations of boolean, character, numeric, or string data. Literalsprovide a means of expressing specific values in your program. For example, in the following statement, an integer variable named count is declared and assigned an integer value.
Java language specifies five major types of literals. They are:
1.    Integer Literals
2.    Floating_Point Literals
3.    Character Literals
4.    String Literals
5.    Boolean Literals

java tokens in hindi | tokens in java java in tokens tutorials
token in java example



No comments:

Post a Comment