Variables, Data Types, and Operators - PowerPoint PPT Presentation

1 / 4
About This Presentation
Title:

Variables, Data Types, and Operators

Description:

This is how you insert a multiline comment. ... bit-wise AND | bit-wise OR ^ bit-wise XOR left shift right shift ~ complement ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 5
Provided by: Sel852
Category:

less

Transcript and Presenter's Notes

Title: Variables, Data Types, and Operators


1
Variables, Data Types, and Operators
  • Variable Declarations Examples
  • int yourAge 34
  • int a 5, b 7, c 21
  • String yourName Bob
  • boolean notOn true
  • Comments
  • / This is how you insert a multiline comment.
    You must enclose it between an opening
    slash-asterisk and a closing asterisk /
  • // And this is how you insert a single-line
    comment.
  • Logical and Arithmetic Operators
  • addition
  • - subtraction
  • multiplication
  • / division
  • modulus
  • lt less than
  • gt greater than
  • lt less than or equal to

2
Variables, Data Types, and Operators
  • Logical and Arithmetic Operators
  • gt greater than or equal to
  • assignment
  • identically equal to
  • ! not equal
  • logical AND
  • logical OR
  • ! Logical NOT
  • bit-wise AND
  • bit-wise OR
  • bit-wise XOR
  • ltlt left shift
  • gtgt right shift
  • complement
  • increment
  • -- decrement
  • add and assign
  • - subtract and assign

3
Variables, Data Types, and Operators
  • Precedence
  • . ()
  • -- !
  • new () casting
  • /
  • -
  • ltlt gtgt
  • lt gt
  • !
  • ? if-then-else
  • -
  • Precedence order is from top-to-bottom,
    left-to-right within the expression

4
Variables, Data Types, and Operators
  • Special use of
  • concatenation Ex. System.out.println(I am
    myAge years old.)
  • Escape characters
  • \n newline
  • \t tab
  • \b backspace
  • \r carriage return
  • \\ backslash
  • \f form-feed
  • \ single quote
  • \ double quote
  • Ex. System.out.println(This is an intentional
    line break. \n The security guard yelled \ Hark!
    Who goes there?\ )
  • Evaluate
  • (93)/67-(2 7) _____________________________
  • (8-3(53)) 2 _____________________________
  • (3 lt4) (52) (!(3 gt2))
    ___________________
Write a Comment
User Comments (0)
About PowerShow.com