Welcome to the World of Online Learning:
Hello Friends “This blog helps you to learn Java programming concepts. You can learn Java language at your own speed and time. One can learn concepts of Java language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Write a Java Basic Input and Output
PROGRAM:Java Basic Input and Output
/*Java Basic Input and Output */
class AssignmentOperator {
public static void main(String[] args) {
System.out.println(“Java programming is interesting.”);
}
}
OUTPUT:- Java programming is interesting
Difference between println(), print() and printf()
1. println()
-
Prints the text/value.
-
Moves the cursor to the next line after printing.
-
Automatically adds a newline at the end.
- System.out.println(“Hello”);
System.out.println(“World”);
2. print()
-
Prints the text/value.
-
Does NOT move to the next line.
-
Cursor stays on the same line.
- System.out.print(“Hello”);
System.out.print(“World”);
3. printf()
-
Prints formatted output (just like in C language).
-
Allows you to use format specifiers (like
%d,%s,%.2f, etc.). -
Does not automatically add a new line unless you use
%nor\n. - System.out.printf(“Age: %d%nName: %s”, 20, “Akash”);