Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions java-multiple-choice-questions-answers.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ D. int num1 = 0, num2 = 0;
```
A. double num1, int num2 = 0;
```
**Explanation**: A. Option A does not compile because Java does not allow declaring different types as part of the same declaration.

## Q. What is the output of following program?
```java
public class Test {
Expand Down Expand Up @@ -214,15 +216,6 @@ Output
a : 2
J : 2
```
## Q. Which of the following declarations does not compile?
A. double num1, int num2 = 0;
B. int num1, num2;
C. int num1, num2 = 0;
D. int num1 = 0, num2 = 0;
```
A. double num1, int num2 = 0;
```
**Explanation**: A. Option A does not compile because Java does not allow declaring different types as part of the same declaration.

## Q. What is the output of the following?
```java
Expand Down