Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is 5 * 5 a literal or just an expression?

I know that for example '5' is literal of type char but is 5 * 5 a literal? This is expression, however it has fixed value.

like image 348
ann dro Avatar asked Sep 04 '15 06:09

ann dro


People also ask

What is the difference between a literal and an expression?

Any literal is an expression, but not every expression is a literal (e.g. x+2 is an expression, where x is a variable, but not a literal. 123 is an integer literal, and also an expression (a very simple one).

What is a literal expression?

A Literal Expression is the simplest form of DMN expression; it is commonly defined as a single-line statement, or an if-else conditional block. The Literal Expression is a type of value expression used in both Decision elements and Business Knowledge Model (BKM) elements.

What is literal expression and give a sample?

Literal language is used to mean exactly what is written. For example: “It was raining a lot, so I rode the bus.” In this example of literal language, the writer means to explain exactly what is written: that he or she chose to ride the bus because of the heavy rain.


1 Answers

As described in Java Language Specification §15.28, it's a particular case of expression called "compile-time constant expression". It's not a literal.

like image 159
Tagir Valeev Avatar answered Sep 24 '22 00:09

Tagir Valeev