Computer Science, asked by donbhai135, 8 months ago

ssignment
1. What is meant by token ? Name the tokens available in Java.
2. What are keywords ? Can keywords be used as identifiers ?
3. What is an identifier ? What is the identifier forming rule(s) of
4. What kind of program elements are the following?
13, 'a', 4.38925, "a", main()
6. What kind of constants are the following?
14, 011, 0X2A, 17, 014, OXBC1
What is a character constant in Java ? How are nongraphic char​

Answers

Answered by Anonymous
1

Answer:

Explanation:

1)Individual words and punctuation marks are called tokens. Every unit that makes a sentence in Java is a token.

The smallest individual unit in a program is known as a Token.

Java has the following types of tokens:

  1. Keywords
  2. Identifiers
  3. Literals
  4. Punctuators
  5. Operators

2)Keywords are the words that convey a special meaning to the language compiler. These are reserved for special purpose and must not be used as normal identifier names.

3)Identifiers are fundamental building blocks of a program and are used as the general terminology for the names given to different parts of the program viz. variables, objects, classes, functions, arrays etc.

Identifier forming rule of Java are as follows:

Identifiers can have alphabets, digits and underscore and doller sign characters.

  1. They must not be a keywords or boolean, literal or null literal.
  2. They must not begin with a digit.
  3. They can be of any length.
  4. Java is case sensitive i.e., upper-case letters and lower-case letters are treated differently.

4)13: is a example for integer literal ,

‘a’: is a example for character literal,

 4.38925: is a example for floating literals in fractional form,

“a”: is a example for String,

main(): is a function

6)14: is an example of Decimal Integer Literals or Decimal Integer constants,

011: is an example of Octal Integer Literals or Octal Integer constants,

0X2A: is an example of HexaDecimal Integer Literals or HexaDecimal Integer constants,

17: is an example of Decimal Integer Literals or Decimal Integer constants,

014: is an example of Octal Integer Literals or Octal Integer constants,

0XBC1: is an example of HexaDecimal Integer Literals or HexaDecimal Integer constants

HOPE IT HELPS U BROTHER

Answered by brundan7019
0

Answer:

First question only I know bro

Explanation:

  • token is the smallest element of a program that is meaningful to the compiler

There are three types of token

  • identifier
  • literals
  • operators
Similar questions