Write a program that displays Welcome to Java, Welcome to Computer Science, and Programming is fun.
Answer:
/**
* Program - 01
* Write a Program that displays:
* Welcome to Java
* Welcome to Computer Science
* Programming is fun.
**/
public class Exercise_01_01{
public static void main(String args[]){ // main method
System.out.println("Welcome to Java");
System.out.println("Welcome to Computer Science");
System.out.println("Programming is fun");
}
}
Output:
Welcome to Java
Welcome to Computer Science
Programming is fun
For displaying output in java, we use the following code statement:
System.out.print();
This statement only prints the output in a single line:
System.out.print("Welcome to all, let's learn Java together");
So the output would be printed in just a single line as:
Welcome to all, let's learn Java together
System: It is a final class defined in the java. lang package.
out: This is an instance of PrintStream type, which is a public and static member field of the System class. ...
We can assume that System. out represents the Standard Output Stream.
System.out.println(); is used to print the output in the next line just like:
System.out.println("Welcome to all, let's learn Java together");
So the output would be printed in a new line as:
Welcome to all, let's learn Java together
Element is found at index:
If you have any doubts or questions, please let me know.