8) ¿QUÉ ES EL OUTPUT EN JAVA?
Java Output
You can simply use
System.out.println(), System.out.print() or System.out.printf() to send output to standard output (screen).System is a class and out is a public static field which accepts output data. Don't worry if you don't understand it. Classes, public, and static will be discussed in later chapters.
Let's take an example to output a line.
class AssignmentOperator {public static void main(String[] args) {System.out.println("Java programming is interesting.");}}
When you run the program, the output will be:
Java programming is interesting.
Here,
println is a method that displays the string inside quotes.What's the difference between println(), print() and printf()?
print()- prints string inside the quotes.println()- prints string inside the quotes similar likeprint()method. Then the cursor moves to the beginning of the next line.printf()- it provides string formatting (similar to printf in C/C++ programming).
gran trabajo
ResponderBorrar