NPTEL » Programming In Java Assignment week 6 Sep-2020

NPTEL Java Assignment week 6

With the growth of Information and Communication Technology, there is a need to develop large and complex software. To meet this requirement object-oriented paradigm has been developed and based on this paradigm the Java programming language emerges as the best programming environment.

NPTEL Programming In Java Assignment 6 Answers 2022

Programming in Java is a MOOC based course which is 12 weeks in duration and can fulfill the criteria of 4 credits in a year. You can visit the NPTEL SWAYAM platform and register yourself for the course. This course is brought to you by Prof. Dr. Debasis Samanta who holds a Ph.D. in Computer Science and Engineering from the Indian Institute of Technology Kharagpur.

Programming In Java 2020 Details:-

  1. Who Can Join: The undergraduate students from the engineering disciplines namely CSE, IT, EE, ECE, etc. might be interested in this course.
  2. Requirements: This course requires that the students are familiar with a programming language such as C/C++ and data structures, algorithms.
  3. INDUSTRY SUPPORT:   All IT companies.

Java Assignment Week 6 Answers:-

Java Week 6: Q1.Complete the code segment to print the following using the concept of extending the Thread class in Java:


Thread is Running.


Sample Test Cases

sample input


// Write the appropriate code to extend the Thread class to complete the class Question61.
public class Question61 extends Thread{

public void run()
System.out.print(“Thread is Running.”);

Java Week 6: Q2

In the following program, a thread class ThreadRun is created using the Runnable interface which prints “Thread using Runnable interface”.


// Create main class Question62 with main() method and appropriate statements in it
public class Question62{
public static void main(String[] args){
ThreadRun a = new ThreadRun();
Thread b = new Thread(a);

Java Week 6: Q3

A part of the Java program is given, which can be completed in many ways, for example using the concept of thread, etc.  Follow the given code and complete the program so that your program prints the message “NPTEL Java”.


// Create a class named MyThread and extend/implement the required class/interface

// Define a method in MyThread class to print the output

class MyThread extends B
public void run()
System.out.print(“NPTEL Java”);}

Java Week 6: Q4

Execution of two or more threads occurs in random order. The keyword ‘synchronized’ in Java is used to control the execution of a thread in a strict sequence. The following program is expected to print some numbers Do the necessary use of the ‘synchronized’ keyword, so that, the program prints the output in the following order:  


synchronized void print(int n){
for(int i=1;i<=5;i++){
catch(Exception e){

Java Week 6: Q5

Add necessary codes to print the following


// Write the necessary code below… t.setPriority(Thread.MAX_PRIORITY); t.start(); t.setName(“NPTEL”);

Find Amazon Quiz Here:

Amazon Fashion Quiz Answers & Win ₹1000

Amazon Great Indian Festival Quiz Answers: Win Rs. 50,000

NOTE: These codes are based on our knowledge. Answers might be incorrect, we suggest you to not the copy-paste answers blindly.