I found the following statement about the Literal concept in the Oracle Java Tutorial:
A literal is the source code representation of a fixed value; literals are represented directly in your code without requiring computation
I understand that int * int
or String + String
... isn't a literal. So I try this code:
int num1 = 3*5;
int num2 = 15
System.out.println(num1==num2);// it print true
My question: 3 * 5 in my code is a literal or not? and why? Thanks!