NPTEL Programming in Java week 4 programming assignment 1 solution

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.

nptel programming in java assignment solutions

Select the Language for this assignment. 
File name for this program : 
1
// Import the required package(s) and/or class(es) 
2
import java.util.Scanner;
3
// Import prdefined package java.lang and class System and all of its member
4
import static java.lang.System.*;
0
// main class Question is created
1
public class Question41{
2
  public static void main(String[] args) {
3
    // Scanner object is created
4
    Scanner scanner = new Scanner(System.in);
5
     // Read String input using scanner class
6
    String courseName = scanner.nextLine(); 
7
     // Print the scanned String
8
    out.println("Course: " + courseName); 
9
  }
10
}
Post a Comment (0)
Previous Question Next Question

You might like