What is Programming in Java?
Java is a popular object-oriented programming language that was first released in 1995. It is used for developing a wide range of applications, including desktop applications, mobile applications, web applications, and enterprise applications.
Here are some key features and concepts of Java programming:
Object-oriented programming: Java is an object-oriented language, which means that it focuses on the creation of objects that contain both data and methods that operate on that data.
Platform independence: Java programs can run on any platform that supports a Java Virtual Machine (JVM), which makes it a popular choice for cross-platform development.
Memory management: Java uses automatic memory management through a garbage collector, which helps to prevent memory leaks and makes it easier to write memory-safe code.
Exception handling: Java has a built-in mechanism for handling runtime errors or exceptions, which helps to ensure that programs can recover gracefully from unexpected errors.
Multi-threading: Java supports multi-threading, which allows programs to execute multiple threads of execution simultaneously, making it well-suited for developing concurrent applications.
Standard libraries: Java provides a large number of standard libraries that developers can use to build applications more quickly and easily, including libraries for networking, database access, and user interface development.
To get started with Java programming, you will need to install the Java Development Kit (JDK) on your computer. Once you have installed the JDK, you can use an Integrated Development Environment (IDE) like Eclipse or IntelliJ IDEA to write and debug your code.
To learn Java programming, you can start with the basics of the language, such as data types, control structures, and object-oriented programming concepts. There are many online resources and tutorials available for learning Java, including Oracle's official Java tutorials, which cover everything from the basics to advanced topics like concurrency and networking.
Week 4 : Programming Assignment 1
Due on 2023-02-23, 23:59 ISTComplete the code segment to execute the following program successfully. You should import the correct package(s) and/or class(s) to complete the code.
Solution :
import java.util.Scanner;
import java.util.LinkedList;
Solution :
import java.util.Scanner;
import java.util.LinkedList; |
Week 4 : Programming Assignment 2
Due on 2023-02-23, 23:59 ISTComplete the code segment to print the current year. Your code should compile successfully.
Note: In this program, you are not allowed to use any import statement. Use should use predefined class Calendar defined in java.util package.
Solution :
// Create an object of Calendar class.
java.util.Calendar current;
// Use getInstance() method to initialize the Calendar object.
current = java.util.Calendar.getInstance();
// Initialize the int variable year with the current year
year = current.get(current.YEAR);
Note: In this program, you are not allowed to use any import statement. Use should use predefined class Calendar defined in java.util package.
Solution :
// Create an object of Calendar class.
java.util.Calendar current;
// Use getInstance() method to initialize the Calendar object.
current = java.util.Calendar.getInstance();
// Initialize the int variable year with the current year
year = current.get(current.YEAR);
|
Week 4 : Programming Assignment 3
Due on 2023-02-23, 23:59 ISTThe program in this assignment is attempted to print the following output:
-----------------OUTPUT-------------------This is small
This is medium
This is large
This is extra-large-------------------------------------------------
However, the code is intentionally injected with some bugs. Debug the code to execute the program successfully.
Solution :
interface ExtraLarge{
static String extra = "This is extra-large";
void display();
}
class Large {
public void Print() {
System.out.println("This is small");
}
}
class Medium extends Large {
public void Print() {
super.Print();
System.out.println("This is medium");
}
}
class Small extends Medium {
public void Print() {
super.Print();
System.out.println("This is large");
}
}
This is medium
This is large
Solution :
interface ExtraLarge{
static String extra = "This is extra-large";
void display();
}
class Large {
public void Print() {
System.out.println("This is small");
}
}
class Medium extends Large {
public void Print() {
super.Print();
System.out.println("This is medium");
}
}
class Small extends Medium {
public void Print() {
super.Print();
System.out.println("This is large");
}
} |
Week 4 : Programming Assignment 4
Due on 2023-02-23, 23:59 ISTComplete the code segment to call the default method in the interface Second then First.Solution :
// Call show() of First interface.
Second.super.show();
// Call show() of Second interface.
First.super.show();
Solution :
// Call show() of First interface.
Second.super.show();
// Call show() of Second interface.
First.super.show(); |
Week 4 : Programming Assignment 5
Solution :
// Interface ShapeX is created
interface ShapeX {
public String base = "This is Shape1";
public void display1();
}
// Interface ShapeY is created which extends ShapeX
interface ShapeY extends ShapeX {
public String base = "This is Shape2";
public void display2();
}
// Class ShapeG is created which implements ShapeY
class ShapeG implements ShapeY {
public String base = "This is Shape3";
//Overriding method in ShapeX interface
public void display1() {
System.out.println("Circle: " + ShapeX.base);
}
// Overriding method in ShapeY interface
public void display2() {
System.out.println("Circle: " + ShapeY.base);
}
} |
CRITERIA TO GET A CERTIFICATE
Average assignment score = 25% of the average of the best 8 assignments out of the total 12 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100
Final score = Average assignment score + Exam score
YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE AVERAGE ASSIGNMENT SCORE >=10/25 AND THE EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.
| Programming in JAVA | Answers |
| Assignment 1 | Click Here |
| Assignment 2 | Click Here |
| Assignment 3 | Click Here |
| Assignment 4 | Click Here |
| Assignment 5 | Click Here |
| Assignment 6 | Click Here |
| Assignment 7 | Click Here |
| Assignment 8 | Click Here |
| Assignment 9 | NA |
| Assignment 10 | NA |
| Assignment 11 | NA |
| Assignment 12 | NA |
Comments
Post a Comment