Ticker

6/recent/ticker-posts

Java Week 4: Q1

/*Complete the code segment to execute the following program successfully. You should import the correct package(s) and/or class(s) to complete the code. */

// Import of pre-defined package java.util and class Scanner
import java.util.Scanner;
// Import of pre-defined package java.lang and class System and all of its member
import static java.lang.System.*;
// main class Question is created
public class Question41{
  public static void main(String[] args) {
// Scanner object is created
    Scanner scanner = new Scanner(System.in);
     // Read String input using scanner class
    String courseName = scanner.nextLine(); 
     // Print the scanned String
    out.println("Course: " + courseName); 
  }
}


Post a Comment

0 Comments