In: Computer Science
Write a complete Java program to print out the name bob
Program:
//program saved as PrintName.java
import java.util.*;
public class PrintName {
public static void main(String[] args) {
String name="Bob";
System.out.println("\nYour name is:
"+name);
//if you want to read the name
from user uncomment the below code
/*
Scanner input=new
Scanner(System.in);
//prompt and read the name
System.out.print("\nEnter your
name: ");
name=input.nextLine();
//print the name
System.out.println("\nYour name is:
"+name);*/
}
}
Output: