CS401 | sw engineering
  • outline
  • projects
  • syllabus
  • links

Java: Expressions and Operators




Operators such as * for multiplication are the same as in C++. Also, comparison operators (e.g. ==), Logical Operators (e.g. && or ||) and Bitwise Operators (e.g. << for left shift) are the same as in C++.



The Math Class This is a class that implements many of the mathematical operations such as square root, absolute value. Remember that Java does not have functions so they need to become methods of a class. You can call the cosine function as follows:
double value = Math.cos(45.0);  /*this will yeild cos(45 degrees) */

cs401:sw engieering

  • home
  • outline
  • projects
  • syllabus
  • links