Why do we use this in Java? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
- 1

Why do we use this in Java?

Why do we use "println" instead of "printin" when using "System.out.println()"?

9th May 2022, 5:58 PM
Djdyn0
10 ответов
+ 10
Because it was named that way. ln is short for "line"
9th May 2022, 6:03 PM
Lisa
Lisa - avatar
+ 4
This naming convention occurs in many programming languages. There are two commonly used functions: System.out.print() System.out.println() The difference is that println adds an extra line break at the end (and typically this is what you want)! So if you want to write multiple things in the same line, you use print().
10th May 2022, 3:50 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Because the method is named println().
9th May 2022, 6:01 PM
Lisa
Lisa - avatar
+ 1
Because it is a method. It is used to change the line.
10th May 2022, 12:18 PM
Mavis
Mavis - avatar
+ 1
Djdyn0 we can give ln in println statement to print the statement in New line whenever we want to print multiple statements in the program We can also provide extra line space between the two print statements using \n in the statement itself as like printf statement Hope you can understand 🙂
10th May 2022, 4:15 PM
RAMA KRISHNA
RAMA KRISHNA - avatar
+ 1
Because Java uses camel case in it's naming convention Example is: toTrim() printIn() The first later uses a small letter while the next is a capital.
11th May 2022, 5:17 PM
Ella
Ella - avatar
0
No that was my bad, I assumed it was printin not println because I thought it was saying "print this in here" instead of "print line"
9th May 2022, 6:11 PM
Djdyn0
- 1
For a bit more context, my "Hello World" command wasn't working because I used an i instead of an l(lowercase L)
9th May 2022, 5:59 PM
Djdyn0
- 1
Well yeah, but why is it named that instead of just printin?
9th May 2022, 6:02 PM
Djdyn0
- 1
Oh!!! That makes sense, I thought it was just saying "Print In" as in, print in this, or "Put this in"
9th May 2022, 6:05 PM
Djdyn0