Question: Q1 : Write a complete Java program that prints out the following information: Your Name in one line The CRN and your email in one
Q1 :
Write a complete Java program that prints out the following information:
- Your Name in one line
- The CRN and your email in one line.
Note:
Include the screenshot of your code and the output as a part of your answer. Otherwise, you will be marked zero for this question.
Answer:
Q2 :
The following program supposes to add two numbers and generates the following output.
Sum of these numbers:35
Unfortunately, the program has compile-time and run-time errors that prevent the program from running and producing the correct result. Using the table below, allocate the error(s) on each program line.
1 public class Main {
2 public static Void main(String[] args)
3 int num1 = 10
4 int num1 = 25;
5 int sum;
6 sum = num1 + num2;
7 System.outprintln("Sum of these numbers: "+sum);
8 }
9
Note:
Some of the answers are given to you as an example.
Table: compile-time / run-time error
| Line No | compile-time / run-time error |
| 1 | No error |
| 2 | Error.
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
