Programming Fundamentals - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Programming Fundamentals

Description:

Programming Fundamentals Ajmer Singh PGT(IP) Programming Fundamentals Java Character Set Character set is a set of valid characters that a language can recognize . – PowerPoint PPT presentation

Number of Views:273
Avg rating:3.0/5.0
Slides: 16
Provided by: others
Category:

less

Transcript and Presenter's Notes

Title: Programming Fundamentals


1
Programming Fundamentals

2
Java Character Set
  • Character set is a set of valid characters that a
    language can recognize . A character represents
    any letter, digit, or any other sign. Java uses
    the Unicode character set.
  • Letters - A-Z, a-z
  • Digits - 0-9
  • Special Symbols - Space - / \ ( )
    ! lt gt . , ! ?
    _(underscore) lt gt _at_
  • White Spaces - Blank spaces, Horizontal
    tab, Carriage return, New line, Form feed.

3
Tokens(Lexical units)
  • The smallest individual unit in a program is
    known as a Token or lexical unit.
  • Types of Tokens -
  • Keywords
  • Identifiers
  • Literals
  • Punctuators
  • Operators

4
Keywords
  • 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. E.g if, else, int,
    float, etc.

5
Identifiers
  • Identifiers are names given to different part of
    the program by user.
  • Rules to write identifiers -
  • They must not begin with digits.
  • No special symbols are used except _(underscore)
    and (dollar sign) character
  • They must not be a keyword.
  • Java is case sensitive language. Upper case and
    lower case letters are treated differently.
  • Examples- myfile , date9_2_7_6

6
Literals
  • Literals (literals) are data items that are fixed
    data values.
  • Types of Literals -
  • Integer literal
  • Floating literal
  • Character literal
  • String literal
  • Boolean literal
  • Null literal

7
Integer Literal
  • Integer literals are whole numbers without any
    fractional part.
  • Three types of Integer literals -
  • Decimal Integer literal
  • Octal Integer literal
  • Hexadecimal Integer literal

8
Decimal Integer literal
  • An integer literal consisting of a sequence of
    digits is taken to be decimal integer literal
    unless it begins with 0 (digit zero).
  • Example- 1296, 5642, 12, 69,-
    23,etc.,

9
Octal Integer literal
  • A sequence of digits starting with 0(digit
    zero) is taken to be an octal integer.
  • Example-0123, 0456, etc.,

10
Hexadecimal Integer literal
  • A sequence of digits preceded by 0x or 0X is
    taken to be an hexadecimal integer.
  • Example- 0x4B6, 0XA43,etc.,

11
Floating literals
  • Floating literals are also called as Real
    literals
  • Real literals are numbers having fractional
    parts. These may be written in one of the two
    forms called fractional form or the exponent
    form.
  • Examples-2.0, 3.5, 8.6, etc.,

12
Character literals
  • A Character literal is one character enclosed in
    single quotes, as in z.
  • Examples- a, b, etc.,

13
String Literals
  • String literal is a sequence of zero or more
    characters surrounded by double quotes( ).
  • Examples-a , ade, etc.,

14
Punctuators or Separators
  • The following characters are used as punctuators.
  • ( ) , .

15
Operators
  • Operators are symbols that perform some action.
    E.g , -, /, etc.
Write a Comment
User Comments (0)
About PowerShow.com