Assignment Operator - PowerPoint PPT Presentation

1 / 2
About This Presentation
Title:

Assignment Operator

Description:

... of the right-hand side of a statement to a variable on the left-hand side of a statement. ... is then assigned to the variable (input) on the left side. ... – PowerPoint PPT presentation

Number of Views:50
Avg rating:3.0/5.0
Slides: 3
Provided by: derek94
Category:

less

Transcript and Presenter's Notes

Title: Assignment Operator


1
Assignment Operator
  • The assignment operator allows us to assign
    the evaluation of the right-hand side of a
    statement to a variable on the left-hand side of
    a statement.
  • Example sum number1 number 2
  • Assume sum, number1, and number2 are int
  • The right hand-side of the statement (number1
    number2) is evaluated first and assigned to the
    variable sum.
  • sum will now hold the value calculated by number1
    number2

2
Assignment Operator (cont.)
  • Another Example
  • String input
  • input JOptionPane.showInputDialog(Enter a
    number )
  • The showInputDialog method will take the user
    input and return it as a String. This simply
    means that the right side of our statement
    becomes a String. This String is then assigned to
    the variable (input) on the left side.
  • Now we may use this String in our program by
    referencing the variable input.
Write a Comment
User Comments (0)
About PowerShow.com