evaluate the java expression a*(++b) % c
Answers
Answer:
yes it is a good questions
Answer:
simple expression is a literal, variable name, or method call. No operators are involved. Here are some examples of simple expressions:
52 // integer literal
age // variable name
System.out.println("ABC"); // method call
"Java" // string literal
98.6D // double precision floating-point literal
89L // long integer literal
A simple expression has a type, which is either a primitive type or a reference type. In these examples, 52 is a 32-bit integer (int); System.out.println("ABC"); is void (void) because it returns no value; "Java" is a string (String); 98.6D is a 64-bit double precision floating-point value (double); and 89L is a 64-bit long integer (long). We don't know age's type.
Experimenting with jshell
You can easily try out these and other simple expressions using jshell. For example, enter 52 at the jshell> prompt and you'll receive something like the following output:
$1 ==> 52
$1 is the name of a scratch variable that jshell creates to store 52. (Scratch variables are created whenever literals are entered.) Execute System.out.println($1) and you'll see 52 as the output.
You can run jshell with the -v command-line argument (jshell -v) to generate verbose feedback. In this case, entering 52 would result in the following message, revealing that scratch variable $1 has int (32-bit integer) type:
| created scratch variable $1 : int
Next, try entering age. In this case, you'll probably receive an error message that the symbol was not found. The Java Shell assumes that age is a variable, but it doesn't know its type. You would have to include a type; for example, see what happens if you enter int age.