The compiler stores strings ( "hello" ) as a set of characters ( 'h', 'e', 'l', 'l', 'o' ). And, in addition, it saves these characters as numbers, which are then represented as bits, etc.
\n represents one character, although I used two characters to write it. The transfer from a human-readable character to a stored number goes through some standardized system, such as ASCII or Unicode. In ASCII, a new line is represented by the decimal number 10 (see http://www.asciitable.com/index/asciifull.gif ). "A" is 65, "B" is 66, and so on. Each lowercase letter has its own number, different from uppercase, starting with 97.
A new line is converted only to a new new line when printing a character. Whenever a special character like \n appears in System.out.print() , the program asks the terminal to return the desired result, for example, skipping the next line.
The terminal delegates this further to the operating system and, finally, to the graphics card in order to actually make the pixels move. Each part has its own area of responsibility, and each other part does not understand how things are going on inside the country. It’s just that they can interact with each other and do things.
Remember that most computer systems are united by a large group of people. Very few know every aspect of what goes on behind the scenes. And the beauty of it all is that they don’t need it!
source share