"And, finally, a lesson from Rishi in the form of a lecture: a pile of useless information. That's what all lecturers love. Just take a glance at it, and that will be enough."

"I'm ready."

"Today I'll tell you about literals. Literals are all data written directly in Java code. Here are some examples:"

Code Description
"Rain In Spain" This is a literal. Its type is String
115 This is a literal. Its type is int
0.256 This is a literal. Its type is double
'\u1234' This is a literal. Its type is char

"Actually, there are plenty of other kinds of literals. You can use literals to assign values of any known type:"

Literal Type Description
123676 int Integer
22223333444433332222L long Long integer
12.323232323f float Fractional number
12.33333333333333333d double Long fractional number
"Rain"
""
"Rain\nIn\nSpain\u123"
String String
'\u3232'
'T'
'5'
char Character
true, false boolean Logical type
null  Object Object reference

"So, code consists of methods, classes, variables, etc., but literals are specific values written directly in the code. Did I get that right?"

"Yes, absolutely."

"Great. I'm finally starting to get this whole Java thing."

undefined
10
Task
New Java Syntax, level 10, lesson 8
Locked
Why you might fail to have a great career
You don’t have to unplug your brain to prevent a meltdown due to an overabundance of new information. We just need to feed it something simple that’s still interesting. Let’s watch an inspiring speech by Larry Smith about why people fail to have great careers unless they follow their passion and see opportunities instead of obstacles.