Write a java program to Print Your Name On Screen[ Parameterised Input].
Answers
Answered by
1
Solution:
The given problem is solved in Java.
public class Main{
public static void main(String name){
System.out.println("Your name is: " + name);
}
}
Explanation:
- Line 1: Class declaration.
- Line 2: Main method declaration. The main method is the starting point of execution. The name is taken as input from parameter.
- Line 3: The name is displayed on the screen using println() statement.
- Line 4: End of main method.
- Line 5: End of class.
Refer to the attachment for output.
Attachments:
Similar questions