COMP 202 Lecture 4: Expressions, Inputs and Random Numbers
jc123 and 40170 others unlocked
100
COMP 202 Full Course Notes
Verified Note
100 documents
Document Summary
Comp 202 lecture 4 expressions, inputs and random numbers. Variables: a named location reserved to store a value. From left to right: parenthesis, multiplication, division, module, addition, subtraction int half = 1/2 ; int one = half + half; Return method values: math. sqrt(4), math. pow(2,3) This would print 0, as the output of the division of two integers will always be an integer. Java will always round towards 0, so = 0 and 0 + 0 = 0. Eg. quotient * 3 + remainder. This represents a single value that needs to be computed. When the program runs, each variable is replaced by its value. Ensure that the expressions types match up! Check through your program for this. Ensure the value between the parenthesis (eg. math. sqrt(4)) evaluates the correct type. Note: the method println is not a variable that can be stored. Println does not return any value. Public static void main(string[] args) { Input argument or command line arguments= string[] args.